Skip to content

Commit 9af04c0

Browse files
committed
Revert "add InterchangeableBinOp inside InstructionsState"
This reverts commit ad7bec9.
1 parent 81698e4 commit 9af04c0

File tree

1 file changed

+3
-32
lines changed

1 file changed

+3
-32
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -957,9 +957,6 @@ class InterchangeableBinOp {
957957
SeenBefore |= opcodeToMask(I->getOpcode());
958958
return trySet(getInterchangeableMask(I));
959959
}
960-
bool contain(Instruction *I) const {
961-
return Mask & getInterchangeableMask(I);
962-
}
963960
unsigned getOpcode() const {
964961
MaskType Candidate = Mask & SeenBefore;
965962
if (Candidate & MainOpBIT)
@@ -1088,9 +1085,6 @@ class InstructionsState {
10881085
/// The main/alternate instruction. MainOp is also VL0.
10891086
Instruction *MainOp = nullptr;
10901087
Instruction *AltOp = nullptr;
1091-
// Only BinaryOperator will activate this.
1092-
std::optional<InterchangeableBinOp> MainOpConverter;
1093-
std::optional<InterchangeableBinOp> AltOpConverter;
10941088

10951089
public:
10961090
Instruction *getMainOp() const {
@@ -1108,26 +1102,11 @@ class InstructionsState {
11081102

11091103
unsigned getAltOpcode() const { return getAltOp()->getOpcode(); }
11101104

1111-
const InterchangeableBinOp &getMainOpConverter() const {
1112-
assert(MainOpConverter && "MainOpConverter is not initialized.");
1113-
return *MainOpConverter;
1114-
}
1115-
1116-
const InterchangeableBinOp &getAltOpConverter() const {
1117-
assert(AltOpConverter && "AltOpConverter is not initialized.");
1118-
return *AltOpConverter;
1119-
}
1120-
1121-
bool hasOpConverter() const { return MainOpConverter && AltOpConverter; }
1122-
11231105
/// Some of the instructions in the list have alternate opcodes.
11241106
bool isAltShuffle() const { return getMainOp() != getAltOp(); }
11251107

11261108
bool isOpcodeOrAlt(Instruction *I) const {
1127-
if (MainOpConverter)
1128-
return getMainOpConverter().contain(I) || getAltOpConverter().contain(I);
1129-
unsigned CheckedOpcode = I->getOpcode();
1130-
return getOpcode() == CheckedOpcode || getAltOpcode() == CheckedOpcode;
1109+
return isConvertible(I, MainOp, AltOp);
11311110
}
11321111

11331112
/// Checks if the current state is valid, i.e. has non-null MainOp
@@ -1136,12 +1115,8 @@ class InstructionsState {
11361115
explicit operator bool() const { return valid(); }
11371116

11381117
InstructionsState() = delete;
1139-
InstructionsState(
1140-
Instruction *MainOp, Instruction *AltOp,
1141-
const std::optional<InterchangeableBinOp> &MainOpConverter = {},
1142-
const std::optional<InterchangeableBinOp> &AltOpConverter = {})
1143-
: MainOp(MainOp), AltOp(AltOp), MainOpConverter(MainOpConverter),
1144-
AltOpConverter(AltOpConverter) {}
1118+
InstructionsState(Instruction *MainOp, Instruction *AltOp)
1119+
: MainOp(MainOp), AltOp(AltOp) {}
11451120
static InstructionsState invalid() { return {nullptr, nullptr}; }
11461121
};
11471122

@@ -1401,10 +1376,6 @@ static InstructionsState getSameOpcode(ArrayRef<Value *> VL,
14011376
AltOp = AlternateInterchangeableConverter
14021377
? FindOp(*AlternateInterchangeableConverter)
14031378
: MainOp;
1404-
return InstructionsState(MainOp, AltOp, InterchangeableConverter,
1405-
AlternateInterchangeableConverter
1406-
? AlternateInterchangeableConverter
1407-
: InterchangeableConverter);
14081379
}
14091380
return InstructionsState(MainOp, AltOp);
14101381
}

0 commit comments

Comments
 (0)