File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
llvm/lib/Transforms/Vectorize Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -2678,7 +2678,6 @@ class LLVM_ABI_FOR_TEST VPReductionRecipe : public VPRecipeWithIRFlags {
26782678 bool IsConditional = false ;
26792679 // / The scaling factor, relative to the VF, that this recipe's output is
26802680 // / divided by.
2681- // / For outer-loop reductions this is equal to 1.
26822681 // / For in-loop reductions this is equal to 0, to specify that this is equal
26832682 // / to the VF (which may not be known yet).
26842683 // / For partial-reductions this is equal to another scalar value.
@@ -2763,8 +2762,11 @@ class LLVM_ABI_FOR_TEST VPReductionRecipe : public VPRecipeWithIRFlags {
27632762 VPValue *getCondOp () const {
27642763 return isConditional () ? getOperand (getNumOperands () - 1 ) : nullptr ;
27652764 }
2766- // / Get the factor that the VF of this recipe's output should be scaled by.
2767- unsigned getVFScaleFactor () const { return VFScaleFactor; }
2765+ // / Get the factor that the VF of this recipe's output should be scaled by, or
2766+ // / null if it isn't scaled.
2767+ std::optional<unsigned > getVFScaleFactor () const {
2768+ return VFScaleFactor > 1 ? std::make_optional (VFScaleFactor) : std::nullopt ;
2769+ }
27682770};
27692771
27702772// / A recipe to represent inloop reduction operations with vector-predication
Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ unsigned vputils::getVFScaleFactor(VPRecipeBase *R) {
146146 if (auto *RR = dyn_cast<VPReductionPHIRecipe>(R))
147147 return RR->getVFScaleFactor ();
148148 if (auto *RR = dyn_cast<VPReductionRecipe>(R))
149- return RR->getVFScaleFactor ();
149+ return RR->getVFScaleFactor (). value_or ( 1 ) ;
150150 assert (
151151 (!isa<VPInstruction>(R) || cast<VPInstruction>(R)->getOpcode () !=
152152 VPInstruction::ReductionStartVector) &&
You can’t perform that action at this time.
0 commit comments