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 | 586b7b75479990475ed5a03fae72d44e0b5ca8e7 (patch) | |
tree | 537b0cb502e5e44ef4b8630abb9d82e48c5e72a9 /lib/Transforms/Scalar/LoopStrengthReduce.cpp | |
parent | ae595dc9dab20f0efa16deab533be219f0c56c5b (diff) |
Call ScalarEvolution's deleteValueFromRecords before deleting an
instruction, not after. This fixes some uses of free'd memory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56908 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 07438e30c7..30e86447f2 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/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; |