diff options
Diffstat (limited to 'lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 33714a2ad2..7b1168e0b4 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/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(); } } |