[PATCH] D19341: Add micro-optimization for 'icmp slt (or A, B), A' to instsimplify.

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 20 14:41:31 PDT 2016


majnemer added inline comments.

================
Comment at: lib/Analysis/InstructionSimplify.cpp:2620
@@ +2619,3 @@
+  {
+    Value *Y = 0;
+    // icmp pred (or X, Y), X
----------------
`nullptr` is preferred.

================
Comment at: lib/Analysis/InstructionSimplify.cpp:2622-2623
@@ +2621,4 @@
+    // icmp pred (or X, Y), X
+    if (LBO && match(LBO, m_CombineOr(m_Or(m_Value(Y), m_Specific(RHS)),
+                                      m_Or(m_Specific(RHS), m_Value(Y))))) {
+      if (Pred == ICmpInst::ICMP_ULT)
----------------
This can be:
  if (LBO && match(LBO, m_c_Or(m_Value(Y), m_Specific(RHS))))

================
Comment at: lib/Analysis/InstructionSimplify.cpp:2643-2644
@@ +2642,4 @@
+    // icmp pred X, (or X, Y)
+    if (RBO && match(RBO, m_CombineOr(m_Or(m_Value(Y), m_Specific(LHS)),
+                                      m_Or(m_Specific(LHS), m_Value(Y))))) {
+      if (Pred == ICmpInst::ICMP_ULE)
----------------
Ditto.


http://reviews.llvm.org/D19341





More information about the llvm-commits mailing list