[PATCH] D111533: [SCEV] Invalidate user SCEVs along with operand SCEVs to avoid cache corruption
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 27 19:39:35 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG513914e1f314: [SCEV] Invalidate user SCEVs along with operand SCEVs to avoid cache corruption (authored by mkazantsev).
Changed prior to commit:
https://reviews.llvm.org/D111533?vs=381479&id=382892#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111533/new/
https://reviews.llvm.org/D111533
Files:
llvm/lib/Analysis/ScalarEvolution.cpp
Index: llvm/lib/Analysis/ScalarEvolution.cpp
===================================================================
--- llvm/lib/Analysis/ScalarEvolution.cpp
+++ llvm/lib/Analysis/ScalarEvolution.cpp
@@ -12737,9 +12737,21 @@
}
void ScalarEvolution::forgetMemoizedResults(ArrayRef<const SCEV *> SCEVs) {
- for (auto *S : SCEVs)
- forgetMemoizedResultsImpl(S);
SmallPtrSet<const SCEV *, 8> ToForget(SCEVs.begin(), SCEVs.end());
+ SmallVector<const SCEV *, 8> Worklist(ToForget.begin(), ToForget.end());
+
+ while (!Worklist.empty()) {
+ const SCEV *Curr = Worklist.pop_back_val();
+ auto Users = SCEVUsers.find(Curr);
+ if (Users != SCEVUsers.end())
+ for (auto *User : Users->second)
+ if (ToForget.insert(User).second)
+ Worklist.push_back(User);
+ }
+
+ for (auto *S : ToForget)
+ forgetMemoizedResultsImpl(S);
+
for (auto I = PredicatedSCEVRewrites.begin();
I != PredicatedSCEVRewrites.end();) {
std::pair<const SCEV *, const Loop *> Entry = I->first;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111533.382892.patch
Type: text/x-patch
Size: 1015 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211028/6955260f/attachment.bin>
More information about the llvm-commits
mailing list