[PATCH] [Instcombine/InstSimplify] Move optimization from instcombine to instsimplify

Nick Lewycky nlewycky at gmail.com
Wed Jun 18 00:17:32 PDT 2014


This needs a test to show what it does. There is a change in behaviour to be tested, opt -instsimplify will start doing something it didn't use to and opt -instcombine should stay the same.

================
Comment at: lib/Analysis/InstructionSimplify.cpp:1630
@@ +1629,3 @@
+  Value *C = nullptr, *D = nullptr;
+  ConstantInt *C1 = nullptr, *C2 = nullptr;
+  if (match(Op0, m_And(m_Value(A), m_Value(C))) &&
----------------
Please sink this down to where they're first assigned (lines 1634, 1635).

================
Comment at: lib/Analysis/InstructionSimplify.cpp:1640
@@ +1639,3 @@
+      // replace with V+N.
+      if (C1->getValue() == ~C2->getValue()) {
+        if ((C2->getValue() & (C2->getValue() + 1)) == 0 && // C2 == 0+1+
----------------
Fold this into the if-statement on line 1636 to reduce indentation one level.

http://reviews.llvm.org/D4100






More information about the llvm-commits mailing list