summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/SimplifyInstructions.cpp
diff options
context:
space:
mode:
authorGerolf Hoflehner <ghoflehner@apple.com>2014-04-26 05:58:11 +0000
committerGerolf Hoflehner <ghoflehner@apple.com>2014-04-26 05:58:11 +0000
commitaf7a87d2e35138fd6358965f060abaaaa12714c7 (patch)
tree7b047d470d140b12393c43456f3abe55cba001f6 /llvm/lib/Transforms/Utils/SimplifyInstructions.cpp
parent1da7cbd584bf4d4c68fdd710adf99e07f93673d7 (diff)
downloadbcm5719-llvm-af7a87d2e35138fd6358965f060abaaaa12714c7.tar.gz
bcm5719-llvm-af7a87d2e35138fd6358965f060abaaaa12714c7.zip
RecursivelyDeleteTriviallyDeadInstructions() could remove
more than 1 instruction. The caller need to be aware of this and adjust instruction iterators accordingly. rdar://16679376 Repaired r207302. llvm-svn: 207309
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyInstructions.cpp')
-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