diff options
author | Chris Lattner <sabre@nondot.org> | 2002-05-26 20:18:18 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-05-26 20:18:18 +0000 |
commit | ab038d44b008fbcf22500c1ac29d3a0d434e80f5 (patch) | |
tree | 0800a2f109235f03ceb2adb6ae17b710beac426f /llvm/lib/Transforms/Utils/Local.cpp | |
parent | 2904f4469356a11c52bcc8432e5cb23d798f2ee1 (diff) | |
download | bcm5719-llvm-ab038d44b008fbcf22500c1ac29d3a0d434e80f5.tar.gz bcm5719-llvm-ab038d44b008fbcf22500c1ac29d3a0d434e80f5.zip |
Simplify the interface to local DCE and Constant prop
llvm-svn: 2749
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index eb06a5b1f92..cc152c6c094 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -16,14 +16,14 @@ // ConstantFoldInstruction - If an instruction references constants, try to fold // them together... // -bool doConstantPropogation(BasicBlock *BB, BasicBlock::iterator &II) { +bool doConstantPropogation(BasicBlock::iterator &II) { Instruction *Inst = *II; if (Constant *C = ConstantFoldInstruction(Inst)) { // Replaces all of the uses of a variable with uses of the constant. Inst->replaceAllUsesWith(C); // Remove the instruction from the basic block... - delete BB->getInstList().remove(II); + delete Inst->getParent()->getInstList().remove(II); return true; } @@ -100,11 +100,11 @@ bool isInstructionTriviallyDead(Instruction *I) { // to point to the instruction that immediately succeeded the original // instruction. // -bool dceInstruction(BasicBlock::InstListType &BBIL, - BasicBlock::iterator &BBI) { +bool dceInstruction(BasicBlock::iterator &BBI) { // Look for un"used" definitions... - if (isInstructionTriviallyDead(*BBI)) { - delete BBIL.remove(BBI); // Bye bye + Instruction *I = *BBI; + if (isInstructionTriviallyDead(I)) { + delete I->getParent()->getInstList().remove(BBI); // Bye bye return true; } return false; |