[llvm-commits] CVS: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Oct 3 16:43:55 PDT 2005
Changes in directory llvm/lib/Transforms/Utils:
SimplifyCFG.cpp updated: 1.91 -> 1.92
---
Log message:
Clean up the code a bit. Use isInstructionTriviallyDead to be more aggressive
and more correct than use_empty(). This fixes PR635: http://llvm.cs.uiuc.edu/PR635 and
SimplifyCFG/2005-10-02-InvokeSimplify.ll
---
Diffs of the changes: (+8 -4)
SimplifyCFG.cpp | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.91 llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.92
--- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.91 Fri Sep 23 13:49:09 2005
+++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp Mon Oct 3 18:43:43 2005
@@ -1284,12 +1284,16 @@
FalseValue, "retval", BI);
else
NewRetVal = TrueValue;
+
+ DEBUG(std::cerr << "\nCHANGING BRANCH TO TWO RETURNS INTO SELECT:"
+ << "\n " << *BI << "Select = " << *NewRetVal
+ << "TRUEBLOCK: " << *TrueSucc << "FALSEBLOCK: "<< *FalseSucc);
new ReturnInst(NewRetVal, BI);
- BI->getParent()->getInstList().erase(BI);
- if (BrCond->use_empty())
- if (Instruction *BrCondI = dyn_cast<Instruction>(BrCond))
- BrCondI->getParent()->getInstList().erase(BrCondI);
+ BI->eraseFromParent();
+ if (Instruction *BrCondI = dyn_cast<Instruction>(BrCond))
+ if (isInstructionTriviallyDead(BrCondI))
+ BrCondI->eraseFromParent();
return true;
}
}
More information about the llvm-commits
mailing list