summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-08-03 21:36:09 +0000
committerChris Lattner <sabre@nondot.org>2005-08-03 21:36:09 +0000
commit84e9baa925e998496716e7ea141da8f18a48776c (patch)
tree34ae49c91a48f7711ff7d94f14a4c4239d7dfcf4 /llvm/lib/Transforms/Scalar
parent938ebaa2b0edcacc13694c01254a265d3e63b341 (diff)
downloadbcm5719-llvm-84e9baa925e998496716e7ea141da8f18a48776c.tar.gz
bcm5719-llvm-84e9baa925e998496716e7ea141da8f18a48776c.zip
Fix a nasty dangling pointer issue. The ScalarEvolution pass would keep a
map from instruction* to SCEVHandles. When we delete instructions, we have to tell it about it. We would run into nasty cases where new instructions were reallocated at old instruction addresses and get the old map values. Bad bad bad :( llvm-svn: 22632
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 33714a2ad20..7b1168e0b48 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -149,7 +149,8 @@ DeleteTriviallyDeadInstructions(std::set<Instruction*> &Insts) {
for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
if (Instruction *U = dyn_cast<Instruction>(I->getOperand(i)))
Insts.insert(U);
- I->getParent()->getInstList().erase(I);
+ SE->deleteInstructionFromRecords(I);
+ I->eraseFromParent();
Changed = true;
}
}
@@ -661,6 +662,7 @@ void LoopStrengthReduce::runOnLoop(Loop *L) {
DeadInsts.insert(BO);
// Break the cycle, then delete the PHI.
PN->replaceAllUsesWith(UndefValue::get(PN->getType()));
+ SE->deleteInstructionFromRecords(PN);
PN->eraseFromParent();
}
}
OpenPOWER on IntegriCloud