diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2011-04-02 22:45:17 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2011-04-02 22:45:17 +0000 |
commit | 17bf4922c9c6d9e12c1e13c09e16a6058fd24b7f (patch) | |
tree | cc633ffcf063402fdd68912f385819c3c6a08160 /llvm/lib/Transforms/Utils/Local.cpp | |
parent | 8baa2c7ad937a4a5bea7f368cc83b4dbce5295a3 (diff) | |
download | bcm5719-llvm-17bf4922c9c6d9e12c1e13c09e16a6058fd24b7f.tar.gz bcm5719-llvm-17bf4922c9c6d9e12c1e13c09e16a6058fd24b7f.zip |
PR9446: RecursivelyDeleteTriviallyDeadInstructions can delete the instruction
after the given instruction; make sure to handle that case correctly.
(It's difficult to trigger; the included testcase involves a dead
block, but I don't think that's a requirement.)
While I'm here, get rid of the unnecessary warning about
SimplifyInstructionsInBlock, since it should work correctly as far as I know.
llvm-svn: 128782
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 47ef1c91749..26ae295d5dc 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -332,8 +332,11 @@ bool llvm::SimplifyInstructionsInBlock(BasicBlock *BB, const TargetData *TD) { BI = BB->begin(); continue; } - + + WeakVH BIHandle(BI); MadeChange |= RecursivelyDeleteTriviallyDeadInstructions(Inst); + if (BIHandle != BI) + BI = BB->begin(); } return MadeChange; } |