[PATCH] D135415: [GlobalISel] Make comparison matcher commutative for commutative predicates

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 6 20:23:08 PDT 2022


arsenm added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h:657-661
+    return (L.match(MRI, TmpMI->getOperand(2).getReg()) &&
+            R.match(MRI, TmpMI->getOperand(3).getReg())) ||
+           (CmpInst::isCommutative(TmpPred) &&
+            (L.match(MRI, TmpMI->getOperand(3).getReg()) &&
+             R.match(MRI, TmpMI->getOperand(2).getReg())));
----------------
The IR version has a separate m_c_ICmp from the regular m_ICmp for whether to bother commuting or not


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

https://reviews.llvm.org/D135415



More information about the llvm-commits mailing list