Skip to content

Conversation

@artagnon
Copy link
Contributor

The change is very difficult to test.

The change is very difficult to test.
@llvmbot
Copy link
Member

llvmbot commented Aug 29, 2025

@llvm/pr-subscribers-vectorizers

@llvm/pr-subscribers-llvm-transforms

Author: Ramkumar Ramachandra (artagnon)

Changes

The change is very difficult to test.


Full diff: https://github.com/llvm/llvm-project/pull/156028.diff

1 Files Affected:

  • (modified) llvm/lib/Transforms/Vectorize/LoopVectorize.cpp (+5-8)
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 6317bc3c20e25..5dfcd26e882d4 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -8567,14 +8567,11 @@ VPlanPtr LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(
 
   VPlanTransforms::createLoopRegions(*Plan);
 
-  // Don't use getDecisionAndClampRange here, because we don't know the UF
-  // so this function is better to be conservative, rather than to split
-  // it up into different VPlans.
-  // TODO: Consider using getDecisionAndClampRange here to split up VPlans.
-  bool IVUpdateMayOverflow = false;
-  for (ElementCount VF : Range)
-    IVUpdateMayOverflow |= !isIndvarOverflowCheckKnownFalse(&CM, VF);
-
+  bool IVUpdateMayOverflow = LoopVectorizationPlanner::getDecisionAndClampRange(
+      [this](ElementCount VF) {
+        return !isIndvarOverflowCheckKnownFalse(&CM, VF);
+      },
+      Range);
   TailFoldingStyle Style = CM.getTailFoldingStyle(IVUpdateMayOverflow);
   // Use NUW for the induction increment if we proved that it won't overflow in
   // the vector loop or when not folding the tail. In the later case, we know

@artagnon
Copy link
Contributor Author

artagnon commented Sep 1, 2025

@fhahn Could you kindly run the data set you have with this patch, in the hope that we find a test case?

@artagnon artagnon closed this Sep 10, 2025
@artagnon artagnon deleted the lv-clamprange-ivoverflow branch September 10, 2025 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants