[llvm] [IndVarSimplify] Invalidate only dispositions after invariant sink (PR #218827)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 20:14:04 PDT 2026


https://github.com/AnonMiraj created https://github.com/llvm/llvm-project/pull/218827

None

>From 4567504681396d7e0d205597a80642a2fcb14a32 Mon Sep 17 00:00:00 2001
From: Anonmiraj <ezzibrahimx at gmail.com>
Date: Mon, 24 Aug 2026 03:34:46 +0300
Subject: [PATCH] [IndVarSimplify] Invalidate only dispositions after invariant
 sink

---
 llvm/lib/Transforms/Scalar/IndVarSimplify.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
index c92efadded635..21b3da3810e94 100644
--- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -1268,10 +1268,12 @@ bool IndVarSimplify::sinkUnusedInvariants(Loop *L) {
 
     // Otherwise, sink it to the exit block.
     I.moveBefore(ExitBlock->getFirstInsertionPt());
-    SE->forgetValue(&I);
     MadeAnyChanges = true;
   }
 
+  if (MadeAnyChanges)
+    SE->forgetBlockAndLoopDispositions();
+
   return MadeAnyChanges;
 }
 



More information about the llvm-commits mailing list