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

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 7 21:18:26 PDT 2022


paquette added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:6079
+      m_c_GICmp(m_Pred(Pred), m_Reg(X), m_GSub(m_Reg(OpLHS), m_Reg(Y))));
+  if (MatchedSub && X != OpLHS)
+    return false;
----------------
arsenm wrote:
> I'm not seeing why sub needs to be handled as a separate case 
The `Y = X == OpLHS ? OpRHS : X == OpRHS ? OpLHS : Register();` part would be wrong for sub because sub is noncommutative.


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

https://reviews.llvm.org/D135380



More information about the llvm-commits mailing list