[PATCH] D136754: [MachineCombiner] Extend reassociation logic to handle inverse instructions

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 5 15:58:55 PST 2022


craig.topper added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/TargetInstrInfo.h:1183
+  virtual std::optional<unsigned> getInverseOpcode(unsigned Opcode) const {
+    return None;
+  }
----------------
std::nullopt?


================
Comment at: llvm/lib/CodeGen/TargetInstrInfo.cpp:748
+         (isAssociativeAndCommutative(*MI1) ||
+          isAssociativeAndCommutative(*MI1, true)) &&
          hasReassociableOperands(*MI1, MBB) &&
----------------
Add `/*Invert*/` before `true`


================
Comment at: llvm/lib/CodeGen/TargetInstrInfo.cpp:761
+  return (isAssociativeAndCommutative(Inst) ||
+          isAssociativeAndCommutative(Inst, true)) &&
          hasReassociableOperands(Inst, Inst.getParent()) &&
----------------
Add /*Invert*/ before true


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136754/new/

https://reviews.llvm.org/D136754



More information about the llvm-commits mailing list