@@ -136,13 +136,6 @@ static cl::opt<bool> ShouldStartVectorizeHorAtStore(
136
136
cl::desc(
137
137
"Attempt to vectorize horizontal reductions feeding into a store"));
138
138
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
-
146
139
static cl::opt<int>
147
140
MaxVectorRegSizeOption("slp-max-reg-size", cl::init(128), cl::Hidden,
148
141
cl::desc("Attempt to vectorize for this register size in bits"));
@@ -17599,10 +17592,9 @@ class HorizontalReduction {
17599
17592
return Num + Vals.size();
17600
17593
});
17601
17594
NumReducedVals < ReductionLimit &&
17602
- (!AllowHorRdxIdenityOptimization ||
17603
- all_of(ReducedVals, [](ArrayRef<Value *> RedV) {
17595
+ all_of(ReducedVals, [](ArrayRef<Value *> RedV) {
17604
17596
return RedV.size() < 2 || !allConstant(RedV) || !isSplat(RedV);
17605
- }))) {
17597
+ })) {
17606
17598
for (ReductionOpsType &RdxOps : ReductionOps)
17607
17599
for (Value *RdxOp : RdxOps)
17608
17600
V.analyzedReductionRoot(cast<Instruction>(RdxOp));
@@ -17732,8 +17724,7 @@ class HorizontalReduction {
17732
17724
}
17733
17725
17734
17726
// Emit code for constant values.
17735
- if (AllowHorRdxIdenityOptimization && Candidates.size() > 1 &&
17736
- allConstant(Candidates)) {
17727
+ if (Candidates.size() > 1 && allConstant(Candidates)) {
17737
17728
Value *Res = Candidates.front();
17738
17729
++VectorizedVals.try_emplace(Candidates.front(), 0).first->getSecond();
17739
17730
for (Value *VC : ArrayRef(Candidates).drop_front()) {
@@ -17748,15 +17739,14 @@ class HorizontalReduction {
17748
17739
17749
17740
unsigned NumReducedVals = Candidates.size();
17750
17741
if (NumReducedVals < ReductionLimit &&
17751
- (NumReducedVals < 2 || !AllowHorRdxIdenityOptimization ||
17752
- !isSplat(Candidates)))
17742
+ (NumReducedVals < 2 || !isSplat(Candidates)))
17753
17743
continue;
17754
17744
17755
17745
// Check if we support repeated scalar values processing (optimization of
17756
17746
// 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;
17760
17750
// Gather same values.
17761
17751
MapVector<Value *, unsigned> SameValuesCounter;
17762
17752
if (IsSupportedHorRdxIdentityOp)
0 commit comments