aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/Local.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-06-25 16:12:52 +0000
committerChris Lattner <sabre@nondot.org>2002-06-25 16:12:52 +0000
commit18961504fc2b299578dba817900a0696cf3ccc4d (patch)
treec34853ffc064b841932d0897e25305c81c3a7338 /lib/Transforms/Utils/Local.cpp
parenta2204e1ff25265a1da00ecbb3ebb22c05acf7194 (diff)
*** empty log message ***
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2777 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/Local.cpp')
-rw-r--r--lib/Transforms/Utils/Local.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp
index cc152c6c09..10028bacec 100644
--- a/lib/Transforms/Utils/Local.cpp
+++ b/lib/Transforms/Utils/Local.cpp
@@ -17,13 +17,12 @@
// them together...
//
bool doConstantPropogation(BasicBlock::iterator &II) {
- Instruction *Inst = *II;
- if (Constant *C = ConstantFoldInstruction(Inst)) {
+ if (Constant *C = ConstantFoldInstruction(II)) {
// Replaces all of the uses of a variable with uses of the constant.
- Inst->replaceAllUsesWith(C);
+ II->replaceAllUsesWith(C);
// Remove the instruction from the basic block...
- delete Inst->getParent()->getInstList().remove(II);
+ II = II->getParent()->getInstList().erase(II);
return true;
}
@@ -102,9 +101,8 @@ bool isInstructionTriviallyDead(Instruction *I) {
//
bool dceInstruction(BasicBlock::iterator &BBI) {
// Look for un"used" definitions...
- Instruction *I = *BBI;
- if (isInstructionTriviallyDead(I)) {
- delete I->getParent()->getInstList().remove(BBI); // Bye bye
+ if (isInstructionTriviallyDead(BBI)) {
+ BBI = BBI->getParent()->getInstList().erase(BBI); // Bye bye
return true;
}
return false;