[llvm] [LoopVectorizer] Allow partial reductions to be made in predicated loops (PR #124268)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 24 08:44:18 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);
+ }
----------------
fhahn wrote:
If you include the mask here, should it also be included in the cost computation? If it doesn't need to be included in the cost computation, can you instead directly predicate the input operand and pass the select as operand to the recipe?
https://github.com/llvm/llvm-project/pull/124268
More information about the llvm-commits
mailing list