diff options
author | Gerolf Hoflehner <ghoflehner@apple.com> | 2014-04-26 05:58:11 +0000 |
---|---|---|
committer | Gerolf Hoflehner <ghoflehner@apple.com> | 2014-04-26 05:58:11 +0000 |
commit | b79f1fe0847d11751a2bb47cb388ee8b4e53003b (patch) | |
tree | 7b0c6b330adc38dd949f299e837eeb3a28c9f2ac /lib/Transforms/Utils/SimplifyInstructions.cpp | |
parent | 67a1d85141f810a3c5b148672e72b4394bcf7a93 (diff) | |
download | llvm-b79f1fe0847d11751a2bb47cb388ee8b4e53003b.tar.gz llvm-b79f1fe0847d11751a2bb47cb388ee8b4e53003b.tar.bz2 llvm-b79f1fe0847d11751a2bb47cb388ee8b4e53003b.tar.xz |
RecursivelyDeleteTriviallyDeadInstructions() could remove
more than 1 instruction. The caller need to be aware of this
and adjust instruction iterators accordingly.
rdar://16679376
Repaired r207302.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207309 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/SimplifyInstructions.cpp')
-rw-r--r-- | lib/Transforms/Utils/SimplifyInstructions.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Transforms/Utils/SimplifyInstructions.cpp b/lib/Transforms/Utils/SimplifyInstructions.cpp index c62aa663f6..33b3637802 100644 --- a/lib/Transforms/Utils/SimplifyInstructions.cpp +++ b/lib/Transforms/Utils/SimplifyInstructions.cpp @@ -76,7 +76,15 @@ namespace { ++NumSimplified; Changed = true; } - Changed |= 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(); + Changed |= res; + } } // Place the list of instructions to simplify on the next loop iteration |