Skip to content

Commit ea092b6

Browse files
committed
rename getInterchangeableInstructionOpcode to getOpcode and getInterchangeableInstructionOps to getOperand
1 parent 29c8cff commit ea092b6

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -820,10 +820,8 @@ namespace {
820820
/// The class maintains a reference to the main instruction (MainOp) and
821821
/// provides methods to:
822822
/// - Check if another instruction is interchangeable (isSame)
823-
/// - Get the opcode for the interchangeable form
824-
/// (getInterchangeableInstructionOpcode)
825-
/// - Get the operands for the interchangeable form
826-
/// (getInterchangeableInstructionOps)
823+
/// - Get the opcode for the interchangeable form (getOpcode)
824+
/// - Get the operands for the interchangeable form (getOperand)
827825
class InterchangeableInstruction {
828826
protected:
829827
Instruction *const MainOp;
@@ -833,11 +831,8 @@ class InterchangeableInstruction {
833831
virtual bool isSame(Instruction *I) {
834832
return MainOp->getOpcode() == I->getOpcode();
835833
}
836-
virtual unsigned getInterchangeableInstructionOpcode() {
837-
return MainOp->getOpcode();
838-
}
839-
virtual SmallVector<Value *>
840-
getInterchangeableInstructionOps(Instruction *I) {
834+
virtual unsigned getOpcode() { return MainOp->getOpcode(); }
835+
virtual SmallVector<Value *> getOperand(Instruction *I) {
841836
assert(MainOp->getOpcode() == I->getOpcode());
842837
return SmallVector<Value *>(MainOp->operands());
843838
}
@@ -939,7 +934,7 @@ class InterchangeableBinOp final : public InterchangeableInstruction {
939934
}
940935
return tryAnd(opcodeToMask(Opcode));
941936
}
942-
unsigned getInterchangeableInstructionOpcode() override {
937+
unsigned getOpcode() override {
943938
MaskType Candidate = Mask & SeenBefore;
944939
if (Candidate & 0b1)
945940
return Instruction::Shl;
@@ -959,8 +954,7 @@ class InterchangeableBinOp final : public InterchangeableInstruction {
959954
return Instruction::Xor;
960955
llvm_unreachable("Cannot find interchangeable instruction.");
961956
}
962-
SmallVector<Value *>
963-
getInterchangeableInstructionOps(Instruction *I) override {
957+
SmallVector<Value *> getOperand(Instruction *I) override {
964958
unsigned ToOpcode = I->getOpcode();
965959
assert(binary_search(SupportedOp, ToOpcode) && "Unsupported opcode.");
966960
unsigned FromOpcode = MainOp->getOpcode();
@@ -1069,12 +1063,11 @@ convertTo(Instruction *I, Instruction *MainOp, Instruction *AltOp) {
10691063
getInterchangeableInstruction(I));
10701064
for (std::unique_ptr<InterchangeableInstruction> &C : Candidate)
10711065
if (C->isSame(I) && C->isSame(MainOp))
1072-
return std::make_pair(MainOp,
1073-
C->getInterchangeableInstructionOps(MainOp));
1066+
return std::make_pair(MainOp, C->getOperand(MainOp));
10741067
Candidate = getInterchangeableInstruction(I);
10751068
for (std::unique_ptr<InterchangeableInstruction> &C : Candidate)
10761069
if (C->isSame(I) && C->isSame(AltOp))
1077-
return std::make_pair(AltOp, C->getInterchangeableInstructionOps(AltOp));
1070+
return std::make_pair(AltOp, C->getOperand(AltOp));
10781071
llvm_unreachable("Cannot convert the instruction.");
10791072
}
10801073

@@ -1366,8 +1359,7 @@ static InstructionsState getSameOpcode(ArrayRef<Value *> VL,
13661359
[&](ArrayRef<std::unique_ptr<InterchangeableInstruction>> Candidate) {
13671360
for (const std::unique_ptr<InterchangeableInstruction> &I :
13681361
Candidate) {
1369-
unsigned InterchangeableInstructionOpcode =
1370-
I->getInterchangeableInstructionOpcode();
1362+
unsigned InterchangeableInstructionOpcode = I->getOpcode();
13711363
for (Value *V : VL) {
13721364
if (isa<PoisonValue>(V))
13731365
continue;

0 commit comments

Comments
 (0)