diff options
author | Dan Gohman <gohman@apple.com> | 2008-10-01 02:02:03 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-10-01 02:02:03 +0000 |
commit | 67d90de2b0dcba2944cea20b878f68200fa03e89 (patch) | |
tree | 78f2a428ea05c8be0314b42bb7dabdf241ef62a2 /llvm/lib | |
parent | e8813812eb294cfcd3cfdb80e3e511396d61f7ad (diff) | |
download | bcm5719-llvm-67d90de2b0dcba2944cea20b878f68200fa03e89.tar.gz bcm5719-llvm-67d90de2b0dcba2944cea20b878f68200fa03e89.zip |
Call ScalarEvolution's deleteValueFromRecords before deleting an
instruction, not after. This fixes some uses of free'd memory.
llvm-svn: 56908
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 07438e30c71..30e86447f25 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -1803,15 +1803,15 @@ ICmpInst *LoopStrengthReduce::OptimizeSMax(Loop *L, ICmpInst *Cond, 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; |