forked from OSchip/llvm-project
[SCEV] Fix usage of invalid IP with FoldingSet
Fix the use of invalid Insertion Point pointer with the UniqueSCEVs FoldingSet, which caused memory corruption.
This commit is contained in:
parent
2543567c41
commit
18eae33122
llvm/lib/Analysis
|
@ -3339,6 +3339,10 @@ const SCEV *ScalarEvolution::getUDivExpr(const SCEV *LHS,
|
|||
}
|
||||
}
|
||||
|
||||
// The Insertion Point (IP) might be invalid by now (due to UniqueSCEVs
|
||||
// changes). Make sure we get a new one.
|
||||
IP = nullptr;
|
||||
if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S;
|
||||
SCEV *S = new (SCEVAllocator) SCEVUDivExpr(ID.Intern(SCEVAllocator),
|
||||
LHS, RHS);
|
||||
UniqueSCEVs.InsertNode(S, IP);
|
||||
|
|
Loading…
Reference in New Issue