summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils
diff options
context:
space:
mode:
authorGerolf Hoflehner <ghoflehner@apple.com>2014-04-26 01:19:16 +0000
committerGerolf Hoflehner <ghoflehner@apple.com>2014-04-26 01:19:16 +0000
commit34210108b320b0ea9ccf2490690612efe702d5f6 (patch)
tree83e3640f9aeed9c659f287dc18ceaaa9d1e0e375 /llvm/lib/Transforms/Utils
parentea18933d9783cbd759bb6454401d810beabb7376 (diff)
downloadbcm5719-llvm-34210108b320b0ea9ccf2490690612efe702d5f6.tar.gz
bcm5719-llvm-34210108b320b0ea9ccf2490690612efe702d5f6.zip
RecursivelyDeleteTriviallyDeadInstructions() could remove
more than 1 instruction. The caller need to be aware of this and adjust instruction iterators accordingly. rdar://16679376 llvm-svn: 207302
Diffstat (limited to 'llvm/lib/Transforms/Utils')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyInstructions.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyInstructions.cpp b/llvm/lib/Transforms/Utils/SimplifyInstructions.cpp
index c62aa663f6d..33b36378027 100644
--- a/llvm/lib/Transforms/Utils/SimplifyInstructions.cpp
+++ b/llvm/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
OpenPOWER on IntegriCloud