[llvm] [SLP] Make getSameOpcode support interchangeable instructions. (PR #133888)
Han-Kuan Chen via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 6 20:46:16 PDT 2025
================
@@ -839,9 +1126,27 @@ class InstructionsState {
/// Some of the instructions in the list have alternate opcodes.
bool isAltShuffle() const { return getMainOp() != getAltOp(); }
- bool isOpcodeOrAlt(Instruction *I) const {
- unsigned CheckedOpcode = I->getOpcode();
- return getOpcode() == CheckedOpcode || getAltOpcode() == CheckedOpcode;
+ /// Checks if the instruction matches either the main or alternate opcode.
+ /// \returns
+ /// - MainOp if \param I matches MainOp's opcode directly or can be converted
+ /// to it
+ /// - AltOp if \param I matches AltOp's opcode directly or can be converted to
+ /// it
+ /// - nullptr if \param I cannot be matched or converted to either opcode
----------------
HanKuanChen wrote:
https://github.com/llvm/llvm-project/pull/134572
https://github.com/llvm/llvm-project/pull/133888
More information about the llvm-commits
mailing list