Skip to content

Commit fa29929

Browse files
committed
[SLP][NFC]Modernize code base in several places
1 parent 7db4ba3 commit fa29929

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4142,8 +4142,9 @@ class BoUpSLP {
41424142
// through the TreeEntry.
41434143
if (TreeEntry *TE = BundleMember->TE) {
41444144
// Need to search for the lane since the tree entry can be reordered.
4145+
auto *In = BundleMember->Inst;
41454146
int Lane = std::distance(TE->Scalars.begin(),
4146-
find(TE->Scalars, BundleMember->Inst));
4147+
find(TE->Scalars, In));
41474148
assert(Lane >= 0 && "Lane not set");
41484149

41494150
// Since vectorization tree is being built recursively this assertion
@@ -4152,16 +4153,13 @@ class BoUpSLP {
41524153
// where their second (immediate) operand is not added. Since
41534154
// immediates do not affect scheduler behavior this is considered
41544155
// okay.
4155-
auto *In = BundleMember->Inst;
41564156
assert(
41574157
In &&
41584158
(isa<ExtractValueInst, ExtractElementInst, IntrinsicInst>(In) ||
41594159
In->getNumOperands() == TE->getNumOperands()) &&
41604160
"Missed TreeEntry operands?");
4161-
(void)In; // fake use to avoid build failure when assertions disabled
41624161

4163-
for (unsigned OpIdx = 0, NumOperands = TE->getNumOperands();
4164-
OpIdx != NumOperands; ++OpIdx)
4162+
for (unsigned OpIdx : seq<unsigned>(TE->getNumOperands()))
41654163
if (auto *I = dyn_cast<Instruction>(TE->getOperand(OpIdx)[Lane]))
41664164
DecrUnsched(I);
41674165
} else {
@@ -9093,7 +9091,7 @@ static bool isAlternateInstruction(const Instruction *I,
90939091
if (auto *MainCI = dyn_cast<CmpInst>(MainOp)) {
90949092
auto *AltCI = cast<CmpInst>(AltOp);
90959093
CmpInst::Predicate MainP = MainCI->getPredicate();
9096-
CmpInst::Predicate AltP = AltCI->getPredicate();
9094+
[[maybe_unused]] CmpInst::Predicate AltP = AltCI->getPredicate();
90979095
assert(MainP != AltP && "Expected different main/alternate predicates.");
90989096
auto *CI = cast<CmpInst>(I);
90999097
if (isCmpSameOrSwapped(MainCI, CI, TLI))
@@ -9106,7 +9104,6 @@ static bool isAlternateInstruction(const Instruction *I,
91069104
assert((MainP == P || AltP == P || MainP == SwappedP || AltP == SwappedP) &&
91079105
"CmpInst expected to match either main or alternate predicate or "
91089106
"their swap.");
9109-
(void)AltP;
91109107
return MainP != P && MainP != SwappedP;
91119108
}
91129109
return I->getOpcode() == AltOp->getOpcode();
@@ -12379,8 +12376,7 @@ static T *performExtractsShuffleAction(
1237912376
else
1238012377
Mask[Idx] = (Res.second ? Idx : Mask[Idx]) + VF;
1238112378
}
12382-
auto *V = ValueSelect::get<T *>(Base);
12383-
(void)V;
12379+
[[maybe_unused]] auto *V = ValueSelect::get<T *>(Base);
1238412380
assert((!V || GetVF(V) == Mask.size()) &&
1238512381
"Expected base vector of VF number of elements.");
1238612382
Prev = Action(Mask, {nullptr, Res.first});
@@ -12431,8 +12427,7 @@ static T *performExtractsShuffleAction(
1243112427
}
1243212428
VMIt = std::next(VMIt);
1243312429
}
12434-
bool IsBaseNotUndef = !IsBaseUndef.all();
12435-
(void)IsBaseNotUndef;
12430+
[[maybe_unused]] bool IsBaseNotUndef = !IsBaseUndef.all();
1243612431
// Perform requested actions for the remaining masks/vectors.
1243712432
for (auto E = ShuffleMask.end(); VMIt != E; ++VMIt) {
1243812433
// Shuffle other input vectors, if any.
@@ -17626,8 +17621,7 @@ void BoUpSLP::scheduleBlock(BlockScheduling *BS) {
1762617621
for (auto *I = BS->ScheduleStart; I != BS->ScheduleEnd;
1762717622
I = I->getNextNode()) {
1762817623
if (ScheduleData *SD = BS->getScheduleData(I)) {
17629-
TreeEntry *SDTE = getTreeEntry(SD->Inst);
17630-
(void)SDTE;
17624+
[[maybe_unused]] TreeEntry *SDTE = getTreeEntry(SD->Inst);
1763117625
assert((isVectorLikeInstWithConstOps(SD->Inst) ||
1763217626
SD->isPartOfBundle() ==
1763317627
(SDTE && !doesNotNeedToSchedule(SDTE->Scalars))) &&

0 commit comments

Comments
 (0)