[llvm-commits] [llvm] r56908 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Dan Gohman
gohman at apple.com
Tue Sep 30 19:02:03 PDT 2008
Author: djg
Date: Tue Sep 30 21:02:03 2008
New Revision: 56908
URL: http://llvm.org/viewvc/llvm-project?rev=56908&view=rev
Log:
Call ScalarEvolution's deleteValueFromRecords before deleting an
instruction, not after. This fixes some uses of free'd memory.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=56908&r1=56907&r2=56908&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Tue Sep 30 21:02:03 2008
@@ -1803,15 +1803,15 @@
Cond->getOperand(0), NewRHS, "scmp", Cond);
// Delete the max calculation instructions.
+ SE->deleteValueFromRecords(Cond);
Cond->replaceAllUsesWith(NewCond);
Cond->eraseFromParent();
- SE->deleteValueFromRecords(Cond);
Instruction *Cmp = cast<Instruction>(Sel->getOperand(0));
- Sel->eraseFromParent();
SE->deleteValueFromRecords(Sel);
+ Sel->eraseFromParent();
if (Cmp->use_empty()) {
- Cmp->eraseFromParent();
SE->deleteValueFromRecords(Cmp);
+ Cmp->eraseFromParent();
}
CondUse->User = NewCond;
return NewCond;
More information about the llvm-commits
mailing list