mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-26 22:34:39 +00:00
In ScalarEvolution::forgetValue, eliminate any SCEVUnknown
entries associated with the value being erased in the folding set map. These entries used to be harmless, because a SCEVUnknown doesn't store any information about its Value*, so having a new Value allocated at the old Value's address wasn't a problem. But now that ScalarEvolution is storing more information about values, this is no longer safe. llvm-svn: 107316
This commit is contained in:
parent
7ae1ebd3b4
commit
547c92af20
@ -3657,6 +3657,26 @@ void ScalarEvolution::forgetValue(Value *V) {
|
||||
ConstantEvolutionLoopExitValue.erase(PN);
|
||||
}
|
||||
|
||||
// If there's a SCEVUnknown tying this value into the SCEV
|
||||
// space, remove it from the folding set map. The SCEVUnknown
|
||||
// object and any other SCEV objects which reference it
|
||||
// (transitively) remain allocated, effectively leaked until
|
||||
// the underlying BumpPtrAllocator is freed.
|
||||
//
|
||||
// This permits SCEV pointers to be used as keys in maps
|
||||
// such as the ValuesAtScopes map.
|
||||
FoldingSetNodeID ID;
|
||||
ID.AddInteger(scUnknown);
|
||||
ID.AddPointer(I);
|
||||
void *IP;
|
||||
if (SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) {
|
||||
UniqueSCEVs.RemoveNode(S);
|
||||
|
||||
// This isn't necessary, but we might as well remove the
|
||||
// value from the ValuesAtScopes map too.
|
||||
ValuesAtScopes.erase(S);
|
||||
}
|
||||
|
||||
PushDefUseChildren(I, Worklist);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user