[llvm] [LV][POC] Use umin to avoid second-to-last iteration problems with EVL (PR #143434)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 9 13:14:17 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
index 161cf8246..733d54c36 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
@@ -2285,8 +2285,9 @@ bool VPlanTransforms::tryAddExplicitVectorLength(
 
   VPBuilder Builder(Header, Header->getFirstNonPhi());
   // Compute original TC - IV as the AVL (application vector length).
-  VPValue *AVL = Builder.createNaryOp(
-      Instruction::Sub, {Plan.getTripCount(), CanonicalIVPHI}, DebugLoc(), "avl");
+  VPValue *AVL = Builder.createNaryOp(Instruction::Sub,
+                                      {Plan.getTripCount(), CanonicalIVPHI},
+                                      DebugLoc(), "avl");
   if (MaxSafeElements) {
     // Support for MaxSafeDist for correct loop emission.
     VPValue *AVLSafe = Plan.getOrAddLiveIn(
@@ -2302,9 +2303,9 @@ bool VPlanTransforms::tryAddExplicitVectorLength(
 
   unsigned BitWidth = CanonicalIVPHI->getScalarType()->getScalarSizeInBits();
   LLVMContext &Ctx = CanonicalIVPHI->getScalarType()->getContext();
-  VPEVL = Builder.createScalarCast(
-          BitWidth > 32 ? Instruction::Trunc : Instruction::ZExt, VPEVL,
-          Type::getInt32Ty(Ctx), DebugLoc());
+  VPEVL = Builder.createScalarCast(BitWidth > 32 ? Instruction::Trunc
+                                                 : Instruction::ZExt,
+                                   VPEVL, Type::getInt32Ty(Ctx), DebugLoc());
 
   transformRecipestoEVLRecipes(Plan, *VPEVL);
 

``````````

</details>


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


More information about the llvm-commits mailing list