Skip to content

Commit cab23cf

Browse files
committed
rename isOpcodeOrAlt to getMatchingMainOpOrAltOp
1 parent 2e06c25 commit cab23cf

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ class InstructionsState {
11331133
/// - AltOp if \param I matches AltOp's opcode directly or can be converted to
11341134
/// it
11351135
/// - nullptr if \param I cannot be matched or converted to either opcode
1136-
Instruction *isOpcodeOrAlt(Instruction *I) const {
1136+
Instruction *getMatchingMainOpOrAltOp(Instruction *I) const {
11371137
assert(MainOp && "MainOp cannot be nullptr.");
11381138
if (I->getOpcode() == MainOp->getOpcode())
11391139
return MainOp;
@@ -1191,7 +1191,7 @@ class InstructionsState {
11911191

11921192
std::pair<Instruction *, SmallVector<Value *>>
11931193
convertTo(Instruction *I, const InstructionsState &S) {
1194-
Instruction *SelectedOp = S.isOpcodeOrAlt(I);
1194+
Instruction *SelectedOp = S.getMatchingMainOpOrAltOp(I);
11951195
assert(SelectedOp && "Cannot convert the instruction.");
11961196
if (I->isBinaryOp()) {
11971197
BinOpSameOpcodeHelper Converter(I);
@@ -1448,7 +1448,7 @@ static InstructionsState getSameOpcode(ArrayRef<Value *> VL,
14481448
assert(all_of(VL,
14491449
[&](Value *V) {
14501450
return isa<PoisonValue>(V) ||
1451-
S.isOpcodeOrAlt(cast<Instruction>(V));
1451+
S.getMatchingMainOpOrAltOp(cast<Instruction>(V));
14521452
}) &&
14531453
"Invalid InstructionsState.");
14541454
return S;
@@ -3822,16 +3822,16 @@ class BoUpSLP {
38223822
/// Some of the instructions in the list have alternate opcodes.
38233823
bool isAltShuffle() const { return S.isAltShuffle(); }
38243824

3825-
Instruction *isOpcodeOrAlt(Instruction *I) const {
3826-
return S.isOpcodeOrAlt(I);
3825+
Instruction *getMatchingMainOpOrAltOp(Instruction *I) const {
3826+
return S.getMatchingMainOpOrAltOp(I);
38273827
}
38283828

38293829
/// Chooses the correct key for scheduling data. If \p Op has the same (or
38303830
/// alternate) opcode as \p OpValue, the key is \p Op. Otherwise the key is
38313831
/// \p OpValue.
38323832
Value *isOneOf(Value *Op) const {
38333833
auto *I = dyn_cast<Instruction>(Op);
3834-
if (I && isOpcodeOrAlt(I))
3834+
if (I && getMatchingMainOpOrAltOp(I))
38353835
return Op;
38363836
return S.getMainOp();
38373837
}
@@ -10309,7 +10309,7 @@ void BoUpSLP::TreeEntry::buildAltOpShuffleMask(
1030910309
static bool isMainInstruction(Instruction *I, Instruction *MainOp,
1031010310
Instruction *AltOp,
1031110311
const TargetLibraryInfo &TLI) {
10312-
return InstructionsState(MainOp, AltOp).isOpcodeOrAlt(I) == MainOp;
10312+
return InstructionsState(MainOp, AltOp).getMatchingMainOpOrAltOp(I) == MainOp;
1031310313
}
1031410314

1031510315
static bool isAlternateInstruction(Instruction *I, Instruction *MainOp,
@@ -10333,7 +10333,7 @@ static bool isAlternateInstruction(Instruction *I, Instruction *MainOp,
1033310333
"their swap.");
1033410334
return MainP != P && MainP != SwappedP;
1033510335
}
10336-
return InstructionsState(MainOp, AltOp).isOpcodeOrAlt(I) == AltOp;
10336+
return InstructionsState(MainOp, AltOp).getMatchingMainOpOrAltOp(I) == AltOp;
1033710337
}
1033810338

1033910339
TTI::OperandValueInfo BoUpSLP::getOperandInfo(ArrayRef<Value *> Ops) {
@@ -13142,7 +13142,8 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
1314213142
return InstructionCost(TTI::TCC_Free);
1314313143

1314413144
auto *VI = cast<Instruction>(UniqueValues[Idx]);
13145-
assert(E->isOpcodeOrAlt(VI) && "Unexpected main/alternate opcode");
13145+
assert(E->getMatchingMainOpOrAltOp(VI) &&
13146+
"Unexpected main/alternate opcode");
1314613147
(void)E;
1314713148
return TTI->getInstructionCost(VI, CostKind);
1314813149
};
@@ -13210,7 +13211,8 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
1321013211
SmallVector<int> Mask;
1321113212
E->buildAltOpShuffleMask(
1321213213
[&](Instruction *I) {
13213-
assert(E->isOpcodeOrAlt(I) && "Unexpected main/alternate opcode");
13214+
assert(E->getMatchingMainOpOrAltOp(I) &&
13215+
"Unexpected main/alternate opcode");
1321413216
return isAlternateInstruction(I, E->getMainOp(), E->getAltOp(),
1321513217
*TLI);
1321613218
},
@@ -15323,7 +15325,8 @@ Instruction &BoUpSLP::getLastInstructionInBundle(const TreeEntry *E) {
1532315325
!isa<GetElementPtrInst>(V))
1532415326
return true;
1532515327
auto *I = dyn_cast<Instruction>(V);
15326-
return !I || !E->isOpcodeOrAlt(I) || I->getParent() == BB ||
15328+
return !I || !E->getMatchingMainOpOrAltOp(I) ||
15329+
I->getParent() == BB ||
1532715330
isVectorLikeInstWithConstOps(I);
1532815331
})) &&
1532915332
"Expected gathered loads or GEPs or instructions from same basic "
@@ -17821,7 +17824,8 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) {
1782117824
SmallVector<int> Mask;
1782217825
E->buildAltOpShuffleMask(
1782317826
[E, this](Instruction *I) {
17824-
assert(E->isOpcodeOrAlt(I) && "Unexpected main/alternate opcode");
17827+
assert(E->getMatchingMainOpOrAltOp(I) &&
17828+
"Unexpected main/alternate opcode");
1782517829
return isAlternateInstruction(I, E->getMainOp(), E->getAltOp(),
1782617830
*TLI);
1782717831
},
@@ -21573,7 +21577,7 @@ class HorizontalReduction {
2157321577
// Also check if the instruction was folded to constant/other value.
2157421578
auto *Inst = dyn_cast<Instruction>(RdxVal);
2157521579
if ((Inst && isVectorLikeInstWithConstOps(Inst) &&
21576-
(!S || !S.isOpcodeOrAlt(Inst))) ||
21580+
(!S || !S.getMatchingMainOpOrAltOp(Inst))) ||
2157721581
(S && !Inst))
2157821582
continue;
2157921583
Candidates.push_back(RdxVal);

0 commit comments

Comments
 (0)