[PATCH] D21417: Fix Side-Conditions in SimplifyCFG for Creating Switches from InstCombine And Mask'd Comparisons

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


majnemer accepted this revision.
majnemer added a comment.
This revision is now accepted and ready to land.

LGTM


================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:475-476
@@ -438,5 +474,4 @@
       if (match(ICI->getOperand(0),
                 m_And(m_Value(RHSVal), m_ConstantInt(RHSC)))) {
-        APInt Not = ~RHSC->getValue();
-        if (Not.isPowerOf2() && C->getValue().isPowerOf2() &&
-            Not != C->getValue()) {
+        APInt Mask = ~RHSC->getValue();
+        if (Mask.isPowerOf2() && (C->getValue() & ~Mask) == C->getValue()) {
----------------
Could we use `m_APInt` here?


http://reviews.llvm.org/D21417





More information about the llvm-commits mailing list