[llvm] [LoopVectorizer] Allow partial reductions to be made in predicated loops (PR #124268)
James Chesterman via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 29 05:12:22 PST 2025
================
@@ -326,6 +326,12 @@ void VPPartialReductionRecipe::execute(VPTransformState &State) {
Type *RetTy = PhiVal->getType();
+ VPValue *Mask = getMask();
+ if (Mask) {
+ Value *MaskVal = State.get(Mask);
+ Value *Zero = ConstantInt::get(BinOpVal->getType(), 0);
+ BinOpVal = Builder.CreateSelect(MaskVal, BinOpVal, Zero);
+ }
----------------
JamesChesterman wrote:
I've made it now so the Select instruction is directly applied to the input operand when creating the partial reduction recipe, thank you for the advice.
https://github.com/llvm/llvm-project/pull/124268
More information about the llvm-commits
mailing list