[PATCH] D85092: [InstSimplify] Peephole optimization for icmp (urem X, Y), X

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 2 07:36:16 PDT 2020


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:2817
 
+  // icmp pred (urem Y, X), Y
+  if (LBO && match(LBO, m_URem(m_Specific(RHS), m_Value()))) {
----------------
Minor nit: `icmp pred (urem X, Y), X` might be better for readability


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:2818
+  // icmp pred (urem Y, X), Y
+  if (LBO && match(LBO, m_URem(m_Specific(RHS), m_Value()))) {
+    if (Pred == ICmpInst::ICMP_ULE)
----------------
`LBO && ` part is not needed, we know it's a non-null ptr already.


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

https://reviews.llvm.org/D85092



More information about the llvm-commits mailing list