projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2543567
)
[SCEV] Fix usage of invalid IP with FoldingSet
author
Ehud Katz
<ehudkatz@gmail.com>
Fri, 13 Mar 2020 16:31:47 +0000
(18:31 +0200)
committer
Ehud Katz
<ehudkatz@gmail.com>
Fri, 13 Mar 2020 16:36:58 +0000
(18:36 +0200)
Fix the use of invalid Insertion Point pointer with the UniqueSCEVs FoldingSet,
which caused memory corruption.
llvm/lib/Analysis/ScalarEvolution.cpp
patch
|
blob
|
history
diff --git
a/llvm/lib/Analysis/ScalarEvolution.cpp
b/llvm/lib/Analysis/ScalarEvolution.cpp
index
debd03b
..
030de8c
100644
(file)
--- a/
llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/
llvm/lib/Analysis/ScalarEvolution.cpp
@@
-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);