From 17bf4922c9c6d9e12c1e13c09e16a6058fd24b7f Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Sat, 2 Apr 2011 22:45:17 +0000 Subject: 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 --- llvm/lib/Transforms/Utils/Local.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'llvm/lib') 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; } -- cgit v1.2.3