[llvm] 54f7104 - [LV] Replace dead invalidateCostModelingDecisions with assert (NFC) (#190837)

via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 8 11:33:08 PDT 2026


Author: Florian Hahn
Date: 2026-04-08T18:33:01Z
New Revision: 54f7104a3484fb33a10c2d66d30d9b05c7a2d80b

URL: https://github.com/llvm/llvm-project/commit/54f7104a3484fb33a10c2d66d30d9b05c7a2d80b
DIFF: https://github.com/llvm/llvm-project/commit/54f7104a3484fb33a10c2d66d30d9b05c7a2d80b.diff

LOG: [LV] Replace dead invalidateCostModelingDecisions with assert (NFC) (#190837)

Replace dead invalidateCostModelingDecisions with assertion that no
decisions have been taken yet.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index fe9b676e36c9d..1fc880208ebf7 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -3797,12 +3797,10 @@ ElementCount LoopVectorizationCostModel::getMaximizedVFForTarget(
     MaxVF =
         clampVFByMaxTripCount(MaxVF, MaxTripCount, UserIC, FoldTailByMasking);
 
-    if (MaxVectorElementCount != MaxVF) {
-      // Invalidate any widening decisions we might have made, in case the loop
-      // requires prediction (decided later), but we have already made some
-      // load/store widening decisions.
-      invalidateCostModelingDecisions();
-    }
+    assert((MaxVectorElementCount == MaxVF ||
+            (WideningDecisions.empty() && CallWideningDecisions.empty() &&
+             Uniforms.empty() && Scalars.empty())) &&
+           "No decisions should have been taken at this point");
   }
   return MaxVF;
 }


        


More information about the llvm-commits mailing list