Skip to content

Commit d0a6434

Browse files
committed
[SLP] Reduce scope of variable using if clause [NFC]
This particular variable name is shadowed by another lower in the function, so reducing it's scope to it's single use removes the shadowing and makes the code much less error prone.
1 parent ef5ba2e commit d0a6434

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17579,14 +17579,14 @@ class HorizontalReduction {
1757917579
// If there are a sufficient number of reduction values, reduce
1758017580
// to a nearby power-of-2. We can safely generate oversized
1758117581
// vectors and rely on the backend to split them to legal sizes.
17582-
unsigned NumReducedVals =
17583-
std::accumulate(ReducedVals.begin(), ReducedVals.end(), 0,
17584-
[](unsigned Num, ArrayRef<Value *> Vals) -> unsigned {
17585-
if (!isGoodForReduction(Vals))
17586-
return Num;
17587-
return Num + Vals.size();
17588-
});
17589-
if (NumReducedVals < ReductionLimit &&
17582+
if (unsigned NumReducedVals = std::accumulate(
17583+
ReducedVals.begin(), ReducedVals.end(), 0,
17584+
[](unsigned Num, ArrayRef<Value *> Vals) -> unsigned {
17585+
if (!isGoodForReduction(Vals))
17586+
return Num;
17587+
return Num + Vals.size();
17588+
});
17589+
NumReducedVals < ReductionLimit &&
1759017590
(!AllowHorRdxIdenityOptimization ||
1759117591
all_of(ReducedVals, [](ArrayRef<Value *> RedV) {
1759217592
return RedV.size() < 2 || !allConstant(RedV) || !isSplat(RedV);

0 commit comments

Comments
 (0)