@@ -136,13 +136,6 @@ static cl::opt<bool> ShouldStartVectorizeHorAtStore(
136136 cl::desc(
137137 "Attempt to vectorize horizontal reductions feeding into a store"));
138138
139- // NOTE: If AllowHorRdxIdenityOptimization is true, the optimization will run
140- // even if we match a reduction but do not vectorize in the end.
141- static cl::opt<bool> AllowHorRdxIdenityOptimization(
142- "slp-optimize-identity-hor-reduction-ops", cl::init(true), cl::Hidden,
143- cl::desc("Allow optimization of original scalar identity operations on "
144- "matched horizontal reductions."));
145-
146139static cl::opt<int>
147140MaxVectorRegSizeOption("slp-max-reg-size", cl::init(128), cl::Hidden,
148141 cl::desc("Attempt to vectorize for this register size in bits"));
@@ -17599,10 +17592,9 @@ class HorizontalReduction {
1759917592 return Num + Vals.size();
1760017593 });
1760117594 NumReducedVals < ReductionLimit &&
17602- (!AllowHorRdxIdenityOptimization ||
17603- all_of(ReducedVals, [](ArrayRef<Value *> RedV) {
17595+ all_of(ReducedVals, [](ArrayRef<Value *> RedV) {
1760417596 return RedV.size() < 2 || !allConstant(RedV) || !isSplat(RedV);
17605- }))) {
17597+ })) {
1760617598 for (ReductionOpsType &RdxOps : ReductionOps)
1760717599 for (Value *RdxOp : RdxOps)
1760817600 V.analyzedReductionRoot(cast<Instruction>(RdxOp));
@@ -17732,8 +17724,7 @@ class HorizontalReduction {
1773217724 }
1773317725
1773417726 // Emit code for constant values.
17735- if (AllowHorRdxIdenityOptimization && Candidates.size() > 1 &&
17736- allConstant(Candidates)) {
17727+ if (Candidates.size() > 1 && allConstant(Candidates)) {
1773717728 Value *Res = Candidates.front();
1773817729 ++VectorizedVals.try_emplace(Candidates.front(), 0).first->getSecond();
1773917730 for (Value *VC : ArrayRef(Candidates).drop_front()) {
@@ -17748,15 +17739,14 @@ class HorizontalReduction {
1774817739
1774917740 unsigned NumReducedVals = Candidates.size();
1775017741 if (NumReducedVals < ReductionLimit &&
17751- (NumReducedVals < 2 || !AllowHorRdxIdenityOptimization ||
17752- !isSplat(Candidates)))
17742+ (NumReducedVals < 2 || !isSplat(Candidates)))
1775317743 continue;
1775417744
1775517745 // Check if we support repeated scalar values processing (optimization of
1775617746 // original scalar identity operations on matched horizontal reductions).
17757- IsSupportedHorRdxIdentityOp =
17758- AllowHorRdxIdenityOptimization && RdxKind != RecurKind::Mul &&
17759- RdxKind != RecurKind::FMul && RdxKind != RecurKind::FMulAdd;
17747+ IsSupportedHorRdxIdentityOp = RdxKind != RecurKind::Mul &&
17748+ RdxKind != RecurKind::FMul &&
17749+ RdxKind != RecurKind::FMulAdd;
1776017750 // Gather same values.
1776117751 MapVector<Value *, unsigned> SameValuesCounter;
1776217752 if (IsSupportedHorRdxIdentityOp)
0 commit comments