[PATCH] D120033: [SCEV] Fully invalidate SCEVUnknown on RAUW

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 22 01:15:42 PST 2022


nikic updated this revision to Diff 410473.
nikic added a comment.

Don't replace value pointer with nullptr.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120033/new/

https://reviews.llvm.org/D120033

Files:
  llvm/lib/Analysis/ScalarEvolution.cpp


Index: llvm/lib/Analysis/ScalarEvolution.cpp
===================================================================
--- llvm/lib/Analysis/ScalarEvolution.cpp
+++ llvm/lib/Analysis/ScalarEvolution.cpp
@@ -527,12 +527,13 @@
 }
 
 void SCEVUnknown::allUsesReplacedWith(Value *New) {
+  // Clear this SCEVUnknown from various maps.
+  SE->forgetMemoizedResults(this);
+
   // Remove this SCEVUnknown from the uniquing map.
   SE->UniqueSCEVs.RemoveNode(this);
 
-  // Update this SCEVUnknown to point to the new value. This is needed
-  // because there may still be outstanding SCEVs which still point to
-  // this SCEVUnknown.
+  // Replace the value pointer in case someone is still using this SCEVUnknown.
   setValPtr(New);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120033.410473.patch
Type: text/x-patch
Size: 728 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220222/6447b5de/attachment.bin>


More information about the llvm-commits mailing list