[llvm] [LV] Vectorize maxnum/minnum w/o fast-math flags. (PR #148239)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 13 13:05:21 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,h -- llvm/include/llvm/Analysis/IVDescriptors.h llvm/lib/Analysis/IVDescriptors.cpp llvm/lib/Transforms/Utils/LoopUtils.cpp llvm/lib/Transforms/Vectorize/LoopVectorize.cpp llvm/lib/Transforms/Vectorize/VPlan.h llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp llvm/lib/Transforms/Vectorize/VPlanTransforms.h
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp b/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp
index 92eb2a52d..37e072e87 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp
@@ -641,9 +641,11 @@ static VPValue *getMinMaxCompareValue(VPSingleDefRecipe *MinMaxOp,
   return MinMaxOp->getOperand(0);
 }
 
-/// Returns true if there VPlan is read-only and execution can be resumed at the beginning of the last vector iteration in the scalar loop
+/// Returns true if there VPlan is read-only and execution can be resumed at the
+/// beginning of the last vector iteration in the scalar loop
 static bool canResumeInScalarLoopFromVectorLoop(VPlan &Plan) {
-  for (VPBlockBase *VPB: vp_depth_first_shallow(Plan.getVectorLoopRegion()->getEntryBasicBlock())) {
+  for (VPBlockBase *VPB : vp_depth_first_shallow(
+           Plan.getVectorLoopRegion()->getEntryBasicBlock())) {
     auto *VPBB = dyn_cast<VPBasicBlock>(VPB);
     if (!VPBB)
       return false;
@@ -664,7 +666,9 @@ bool VPlanTransforms::handleMaxMinNumReductionsWithoutFastMath(VPlan &Plan) {
   VPRecipeWithIRFlags *MinMaxOp = nullptr;
   bool HasUnsupportedPhi = false;
   for (auto &R : LoopRegion->getEntryBasicBlock()->phis()) {
-    HasUnsupportedPhi |= !isa<VPCanonicalIVPHIRecipe, VPWidenIntOrFpInductionRecipe, VPReductionPHIRecipe>(&R);
+    HasUnsupportedPhi |=
+        !isa<VPCanonicalIVPHIRecipe, VPWidenIntOrFpInductionRecipe,
+             VPReductionPHIRecipe>(&R);
     auto *Cur = dyn_cast<VPReductionPHIRecipe>(&R);
     if (!Cur)
       continue;
@@ -698,7 +702,9 @@ bool VPlanTransforms::handleMaxMinNumReductionsWithoutFastMath(VPlan &Plan) {
 
   auto *MiddleVPBB = Plan.getMiddleBlock();
   auto *RdxResult = dyn_cast<VPInstruction>(&MiddleVPBB->front());
-  if (!RdxResult || RdxResult->getOpcode() != VPInstruction::ComputeReductionResult || RdxResult->getOperand(0) != RedPhiR)
+  if (!RdxResult ||
+      RdxResult->getOpcode() != VPInstruction::ComputeReductionResult ||
+      RdxResult->getOperand(0) != RedPhiR)
     return false;
 
   auto *ScalarPH = Plan.getScalarPreheader();

``````````

</details>


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


More information about the llvm-commits mailing list