]> granicus.if.org Git - llvm/commitdiff
Use m_APInt in SimplifyCFG
authorChuang-Yu Cheng <cycheng@multicorewareinc.com>
Fri, 17 Jun 2016 00:04:39 +0000 (00:04 +0000)
committerChuang-Yu Cheng <cycheng@multicorewareinc.com>
Fri, 17 Jun 2016 00:04:39 +0000 (00:04 +0000)
Switch from m_Constant to m_APInt per David's request. NFC.

Author: Thomas Jablin (tjablin)
Reviewers: majnemer cycheng

http://reviews.llvm.org/D21440

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272977 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/SimplifyCFG.cpp

index 4f0dc5a6b35d62f6e13407aab587edb7db6dcc75..43e823d601e465dc8cb477a9a06fea320373ed08 100644 (file)
@@ -442,7 +442,7 @@ private:
     }
 
     Value *RHSVal;
-    ConstantInt *RHSC;
+    const APInt *RHSC;
 
     // Pattern match a special case
     // (x & ~2^z) == y --> x == y || x == y|2^z
@@ -487,8 +487,8 @@ private:
         );
       */
       if (match(ICI->getOperand(0),
-                m_And(m_Value(RHSVal), m_ConstantInt(RHSC)))) {
-        APInt Mask = ~RHSC->getValue();
+                m_And(m_Value(RHSVal), m_APInt(RHSC)))) {
+        APInt Mask = ~*RHSC;
         if (Mask.isPowerOf2() && (C->getValue() & ~Mask) == C->getValue()) {
           // If we already have a value for the switch, it has to match!
           if (!setValueOnce(RHSVal))
@@ -519,8 +519,8 @@ private:
     // Shift the range if the compare is fed by an add. This is the range
     // compare idiom as emitted by instcombine.
     Value *CandidateVal = I->getOperand(0);
-    if (match(I->getOperand(0), m_Add(m_Value(RHSVal), m_ConstantInt(RHSC)))) {
-      Span = Span.subtract(RHSC->getValue());
+    if (match(I->getOperand(0), m_Add(m_Value(RHSVal), m_APInt(RHSC)))) {
+      Span = Span.subtract(*RHSC);
       CandidateVal = RHSVal;
     }