diff options
author | Gerolf Hoflehner <ghoflehner@apple.com> | 2014-04-26 01:19:16 +0000 |
---|---|---|
committer | Gerolf Hoflehner <ghoflehner@apple.com> | 2014-04-26 01:19:16 +0000 |
commit | 4c9277bb9fc1399aa0c845c870447ae83cdb2cb1 (patch) | |
tree | b723dacc83eb65812a1bb56837260d4b1bf2f292 /lib/Transforms/Scalar | |
parent | 9e93e47b7f196893b5779090897210d750aa1c6b (diff) | |
download | llvm-4c9277bb9fc1399aa0c845c870447ae83cdb2cb1.tar.gz llvm-4c9277bb9fc1399aa0c845c870447ae83cdb2cb1.tar.bz2 llvm-4c9277bb9fc1399aa0c845c870447ae83cdb2cb1.tar.xz |
RecursivelyDeleteTriviallyDeadInstructions() could remove
more than 1 instruction. The caller need to be aware of this
and adjust instruction iterators accordingly.
rdar://16679376
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207302 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar')
-rw-r--r-- | lib/Transforms/Scalar/LoopInstSimplify.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/LoopInstSimplify.cpp b/lib/Transforms/Scalar/LoopInstSimplify.cpp index a61923cabf..ab1a9393c5 100644 --- a/lib/Transforms/Scalar/LoopInstSimplify.cpp +++ b/lib/Transforms/Scalar/LoopInstSimplify.cpp @@ -127,7 +127,15 @@ bool LoopInstSimplify::runOnLoop(Loop *L, LPPassManager &LPM) { ++NumSimplified; } } - LocalChanged |= RecursivelyDeleteTriviallyDeadInstructions(I, TLI); + bool res = RecursivelyDeleteTriviallyDeadInstructions(I, TLI); + if (res) { + // RecursivelyDeleteTriviallyDeadInstruction can remove + // more than one instruction, so simply incrementing the + // iterator does not work. When instructions get deleted + // re-iterate instead. + BI = BB->begin(); BE = BB->end(); + LocalChanged |= res; + } if (IsSubloopHeader && !isa<PHINode>(I)) break; |