[llvm] [JumpThreading] Invalidate LVI after `combineMetadataForCSE`. (PR #65219)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 3 11:20:17 PDT 2023


================
@@ -259,17 +262,20 @@ namespace {
   };
 }
 
-void LazyValueInfoCache::eraseValue(Value *V) {
-  for (auto &Pair : BlockCache) {
-    Pair.second->LatticeElements.erase(V);
-    Pair.second->OverDefined.erase(V);
-    if (Pair.second->NonNullPointers)
-      Pair.second->NonNullPointers->erase(V);
-  }
+void LazyValueInfoCache::forgetValue(Value *V) {
+    for (auto &Pair : BlockCache) {
+      Pair.second->LatticeElements.erase(V);
+      Pair.second->OverDefined.erase(V);
+      if (Pair.second->NonNullPointers)
+        Pair.second->NonNullPointers->erase(V);
+    }
+}
 
-  auto HandleIt = ValueHandles.find_as(V);
-  if (HandleIt != ValueHandles.end())
-    ValueHandles.erase(HandleIt);
+void LazyValueInfoCache::eraseValue(Value *V) {
+    forgetValue(V);
+    auto HandleIt = ValueHandles.find_as(V);
+    if (HandleIt != ValueHandles.end())
+      ValueHandles.erase(HandleIt);
----------------
nikic wrote:

I don't think forgetValue/eraseValue should be split into two methods. If you forget information about the value in BlockCache, then you should also drop the value handle (as it is used to forget information in block cache, so no longer serves a purpose).

https://github.com/llvm/llvm-project/pull/65219


More information about the llvm-commits mailing list