[llvm] 7df3d92 - [VPlan] Add VPReplicateRecipe::operandsWithoutMask() (NFC). (#202115)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 7 05:10:10 PDT 2026


Author: Florian Hahn
Date: 2026-06-07T14:10:05+02:00
New Revision: 7df3d9277973096d3b4231b6819b2fcc5603c67e

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

LOG: [VPlan] Add VPReplicateRecipe::operandsWithoutMask() (NFC). (#202115)

Add a helper to access a VPReplicateRecipe's operands while excluding
the mask of a predicated recipe, and use it in createReplicateRegion.

Split off from https://github.com/llvm/llvm-project/pull/201676.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlan.h
    llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index eb43f384a7c9d..71080705a1c6e 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -3481,6 +3481,11 @@ class LLVM_ABI_FOR_TEST VPReplicateRecipe : public VPRecipeWithIRFlags,
     return getOperand(getNumOperands() - 1);
   }
 
+  /// Return the recipe's operands, excluding the mask of a predicated recipe.
+  operand_range operandsWithoutMask() {
+    return isPredicated() ? drop_end(operands()) : operands();
+  }
+
   unsigned getOpcode() const { return getUnderlyingInstr()->getOpcode(); }
 
 protected:

diff  --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
index c2afae9ccca8c..bd292e22135a9 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
@@ -529,7 +529,7 @@ static VPRegionBlock *createReplicateRegion(VPReplicateRecipe *PredRecipe,
   // Replace predicated replicate recipe with a replicate recipe without a
   // mask but in the replicate region.
   auto *RecipeWithoutMask = new VPReplicateRecipe(
-      PredRecipe->getUnderlyingInstr(), drop_end(PredRecipe->operands()),
+      PredRecipe->getUnderlyingInstr(), PredRecipe->operandsWithoutMask(),
       PredRecipe->isSingleScalar(), nullptr /*Mask*/, *PredRecipe, *PredRecipe,
       PredRecipe->getDebugLoc());
   auto *Pred =


        


More information about the llvm-commits mailing list