mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-17 20:23:59 +00:00
Indvars needs to explicitly notify ScalarEvolution when it is replacing
a loop exit value, so that if a loop gets deleted, ScalarEvolution isn't stick holding on to dangling SCEVAddRecExprs for that loop. This fixes PR6339. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96626 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -3485,6 +3485,35 @@ void ScalarEvolution::forgetLoop(const Loop *L) {
|
||||
}
|
||||
}
|
||||
|
||||
/// forgetValue - This method should be called by the client when it has
|
||||
/// changed a value in a way that may effect its value, or which may
|
||||
/// disconnect it from a def-use chain linking it to a loop.
|
||||
void ScalarEvolution::forgetValue(Value *V) {
|
||||
Instruction *I = dyn_cast<Instruction>(V);
|
||||
if (!I) return;
|
||||
|
||||
// Drop information about expressions based on loop-header PHIs.
|
||||
SmallVector<Instruction *, 16> Worklist;
|
||||
Worklist.push_back(I);
|
||||
|
||||
SmallPtrSet<Instruction *, 8> Visited;
|
||||
while (!Worklist.empty()) {
|
||||
I = Worklist.pop_back_val();
|
||||
if (!Visited.insert(I)) continue;
|
||||
|
||||
std::map<SCEVCallbackVH, const SCEV *>::iterator It =
|
||||
Scalars.find(static_cast<Value *>(I));
|
||||
if (It != Scalars.end()) {
|
||||
ValuesAtScopes.erase(It->second);
|
||||
Scalars.erase(It);
|
||||
if (PHINode *PN = dyn_cast<PHINode>(I))
|
||||
ConstantEvolutionLoopExitValue.erase(PN);
|
||||
}
|
||||
|
||||
PushDefUseChildren(I, Worklist);
|
||||
}
|
||||
}
|
||||
|
||||
/// ComputeBackedgeTakenCount - Compute the number of times the backedge
|
||||
/// of the specified loop will execute.
|
||||
ScalarEvolution::BackedgeTakenInfo
|
||||
|
Reference in New Issue
Block a user