[llvm] d777b1a - [VPlan] Skip phi recipes in tryToBuildVPlan (NFC).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 27 09:04:22 PST 2025


Author: Florian Hahn
Date: 2025-12-27T17:02:48Z
New Revision: d777b1a23038331320b83e9b313f0dd40f675273

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

LOG: [VPlan] Skip phi recipes in tryToBuildVPlan (NFC).

No phi recipes are being transformed in the main loop any longer, so
skip phi recipes.

This also allows to clarify which recipes need skipping explicitly.
Those are recipes that have been already transformed.

Follow-up to post-commit comment in
https://github.com/llvm/llvm-project/pull/168291.

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 2c62f64be1c9b..40c3efb644527 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -8457,12 +8457,13 @@ VPlanPtr LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(
   // Now process all other blocks and instructions.
   for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(RPOT)) {
     // Convert input VPInstructions to widened recipes.
-    for (VPRecipeBase &R : make_early_inc_range(*VPBB)) {
-      auto *VPI = dyn_cast<VPInstruction>(&R);
-      // Skip recipes that do not need transforming, including
-      // non-VPInstructions (such as ...) and VPInstructions without underlying
-      // values. The latter are added above for masking.
-      if (!VPI || !VPI->getUnderlyingValue())
+    for (VPRecipeBase &R : make_early_inc_range(
+             make_range(VPBB->getFirstNonPhi(), VPBB->end()))) {
+      // Skip recipes that do not need transforming.
+      if (isa<VPWidenCanonicalIVRecipe, VPBlendRecipe, VPReductionRecipe>(&R))
+        continue;
+      auto *VPI = cast<VPInstruction>(&R);
+      if (!VPI->getUnderlyingValue())
         continue;
 
       // TODO: Gradually replace uses of underlying instruction by analyses on


        


More information about the llvm-commits mailing list