[llvm] [SLP] Make getSameOpcode support different instructions if they have same semantics. (PR #112181)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 15 07:19:39 PDT 2024
================
@@ -832,8 +832,107 @@ struct InstructionsState {
: OpValue(OpValue), MainOp(MainOp), AltOp(AltOp) {}
};
+struct InterchangeableInstruction {
+ unsigned Opcode;
+ SmallVector<Value *> Ops;
+ template <class... ArgTypes>
+ InterchangeableInstruction(unsigned Opcode, ArgTypes &&...Args)
+ : Opcode(Opcode), Ops{std::forward<decltype(Args)>(Args)...} {}
+};
+
+bool operator<(const InterchangeableInstruction &LHS,
+ const InterchangeableInstruction &RHS) {
+ return LHS.Opcode < RHS.Opcode;
+}
+
} // end anonymous namespace
+/// \returns a list of interchangeable instructions which \p I can be converted
----------------
alexey-bataev wrote:
```suggestion
/// \returns Sorted by instruction opcode list of interchangeable instructions which \p I can be converted
```
https://github.com/llvm/llvm-project/pull/112181
More information about the llvm-commits
mailing list