[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
Mon Oct 14 13:46:24 PDT 2024


================
@@ -834,6 +834,105 @@ struct InstructionsState {
 
 } // end anonymous namespace
 
+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;
+}
----------------
alexey-bataev wrote:

Put all these declarations to an anonymous namespace

https://github.com/llvm/llvm-project/pull/112181


More information about the llvm-commits mailing list