[PATCH] D135380: [GlobalISel] Combine (X op Y) == X --> Y == 0

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 6 12:49:42 PDT 2022


arsenm added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:6062
+  Register LHS, RHS;
+  mi_match(Dst, MRI, m_GICmp(m_Pred(Pred), m_Reg(LHS), m_Reg(RHS)));
+  if (!ICmpInst::isEquality(Pred))
----------------
Can you really get away without checking the mi_match result?


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:6074-6075
+  };
+  if (!Match(/*MaybeBinOp = */ LHS, /*X = */ RHS) &&
+      !Match(/*MaybeBinOp = */ RHS, /*X = */ LHS))
+    return false;
----------------
Should there be commutative variants of the matchers like in the IR version?


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

https://reviews.llvm.org/D135380



More information about the llvm-commits mailing list