[PATCH] D21397: Teach SimplifyCFG to Create Switches from InstCombine Or Mask'd Comparisons

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 15 15:20:13 PDT 2016


majnemer added inline comments.

================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:478
@@ -438,2 +477,3 @@
       if (match(ICI->getOperand(0),
                 m_And(m_Value(RHSVal), m_ConstantInt(RHSC)))) {
+        APInt Mask = ~RHSC->getValue();
----------------
Why not use `m_APInt`?

================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:482
@@ +481,3 @@
+          // If we already have a value for the switch, it has to match!
+          if(!setValueOnce(RHSVal))
+            return false;
----------------
Please clang-format this.

================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:500
@@ +499,3 @@
+      if (match(ICI->getOperand(0),
+                m_Or(m_Value(RHSVal), m_ConstantInt(RHSC)))) {
+        APInt Mask = RHSC->getValue();
----------------
Ditto.


http://reviews.llvm.org/D21397





More information about the llvm-commits mailing list