Skip to content

Commit 220a4e3

Browse files
Address comments on PR
Involves adding an extra if statement and changing a comment.
1 parent c7f986c commit 220a4e3

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8918,8 +8918,8 @@ VPRecipeBuilder::tryToCreatePartialReduction(Instruction *Reduction,
89188918
isa<VPPartialReductionRecipe>(BinOpRecipe))
89198919
std::swap(BinOp, Accumulator);
89208920

8921-
VPValue *Mask = getBlockInMask(Reduction->getParent());
8922-
if (Mask) {
8921+
if (CM.blockNeedsPredicationForAnyReason(Reduction->getParent())) {
8922+
VPValue *Mask = getBlockInMask(Reduction->getParent());
89238923
VPValue *Zero =
89248924
Plan.getOrAddLiveIn(ConstantInt::get(Reduction->getType(), 0));
89258925
BinOp = Builder.createSelect(Mask, BinOp, Zero, Reduction->getDebugLoc());

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2104,8 +2104,7 @@ class VPReductionPHIRecipe : public VPHeaderPHIRecipe,
21042104
/// A recipe for forming partial reductions. In the loop, an accumulator and
21052105
/// vector operand are added together and passed to the next iteration as the
21062106
/// next accumulator. After the loop body, the accumulator is reduced to a
2107-
/// scalar value. If the mask operand is not nullptr then it is applied to the
2108-
/// vector operand on each iteration.
2107+
/// scalar value.
21092108
class VPPartialReductionRecipe : public VPSingleDefRecipe {
21102109
unsigned Opcode;
21112110

0 commit comments

Comments
 (0)