[llvm] r303968 - [InstSimplify] Use APInt::isMask isntead of manually implementing it. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu May 25 22:16:22 PDT 2017


Author: ctopper
Date: Fri May 26 00:16:22 2017
New Revision: 303968

URL: http://llvm.org/viewvc/llvm-project?rev=303968&view=rev
Log:
[InstSimplify] Use APInt::isMask isntead of manually implementing it. NFC

Modified:
    llvm/trunk/lib/Analysis/InstructionSimplify.cpp

Modified: llvm/trunk/lib/Analysis/InstructionSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InstructionSimplify.cpp?rev=303968&r1=303967&r2=303968&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/InstructionSimplify.cpp (original)
+++ llvm/trunk/lib/Analysis/InstructionSimplify.cpp Fri May 26 00:16:22 2017
@@ -1931,7 +1931,7 @@ static Value *SimplifyOrInst(Value *Op0,
       // .. and C2 = ~C1 and C2 is 0+1+ and (N & C2) == 0
       // replace with V+N.
       Value *V1, *V2;
-      if ((C2->getValue() & (C2->getValue() + 1)) == 0 && // C2 == 0+1+
+      if (C2->getValue().isMask() && // C2 == 0+1+
           match(A, m_Add(m_Value(V1), m_Value(V2)))) {
         // Add commutes, try both ways.
         if (V1 == B &&
@@ -1942,7 +1942,7 @@ static Value *SimplifyOrInst(Value *Op0,
           return A;
       }
       // Or commutes, try both ways.
-      if ((C1->getValue() & (C1->getValue() + 1)) == 0 &&
+      if (C1->getValue().isMask() &&
           match(B, m_Add(m_Value(V1), m_Value(V2)))) {
         // Add commutes, try both ways.
         if (V1 == A &&




More information about the llvm-commits mailing list