mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-05 10:17:37 +00:00
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
This commit is contained in:
parent
ae595dc9da
commit
586b7b7547
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user