aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/LevelRaise.cpp2
-rw-r--r--lib/Transforms/Scalar/DCE.cpp2
-rw-r--r--lib/Transforms/Scalar/LICM.cpp2
-rw-r--r--lib/Transforms/Utils/Local.cpp12
4 files changed, 9 insertions, 9 deletions
diff --git a/lib/Transforms/LevelRaise.cpp b/lib/Transforms/LevelRaise.cpp
index 8703b928b4..b0bae97558 100644
--- a/lib/Transforms/LevelRaise.cpp
+++ b/lib/Transforms/LevelRaise.cpp
@@ -443,7 +443,7 @@ static bool DoRaisePass(Function *F) {
for (BasicBlock::iterator BI = BB->begin(); BI != BB->end();) {
DEBUG(cerr << "Processing: " << *BI);
- if (dceInstruction(BIL, BI) || doConstantPropogation(BB, BI)) {
+ if (dceInstruction(BI) || doConstantPropogation(BI)) {
Changed = true;
++NumDCEorCP;
DEBUG(cerr << "***\t\t^^-- DeadCode Elinated!\n");
diff --git a/lib/Transforms/Scalar/DCE.cpp b/lib/Transforms/Scalar/DCE.cpp
index 2c9c8b3b0d..fa2392fbb4 100644
--- a/lib/Transforms/Scalar/DCE.cpp
+++ b/lib/Transforms/Scalar/DCE.cpp
@@ -32,7 +32,7 @@ namespace {
BasicBlock::InstListType &Vals = BB->getInstList();
bool Changed = false;
for (BasicBlock::iterator DI = Vals.begin(); DI != Vals.end(); )
- if (dceInstruction(Vals, DI)) {
+ if (dceInstruction(DI)) {
Changed = true;
++DIEEliminated;
} else
diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp
index 3be163ce41..2e5adf6f7a 100644
--- a/lib/Transforms/Scalar/LICM.cpp
+++ b/lib/Transforms/Scalar/LICM.cpp
@@ -184,7 +184,7 @@ void LICM::visitBasicBlock(BasicBlock *BB) {
visit(BB->begin()[i]);
BasicBlock::iterator It = BB->begin()+i;
- if (dceInstruction(BB->getInstList(), It))
+ if (dceInstruction(It))
Changed = true;
else
++i;
diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp
index eb06a5b1f9..cc152c6c09 100644
--- a/lib/Transforms/Utils/Local.cpp
+++ b/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;