]> granicus.if.org Git - llvm/commitdiff
[DAGCombine] Use APInt::extractBits in "sub-splat" constant mask detection. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 7 Jun 2019 18:07:06 +0000 (18:07 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 7 Jun 2019 18:07:06 +0000 (18:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362820 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/DAGCombiner.cpp

index f78f775017a29874de1e2bd081d7bb8c894e0fc3..696de2c575d8581465ff24ba9c8ed731942631c0 100644 (file)
@@ -5005,10 +5005,10 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
 
         // Make sure that variable 'Constant' is only set if 'SplatBitSize' is a
         // multiple of 'BitWidth'. Otherwise, we could propagate a wrong value.
-        if (SplatBitSize % BitWidth == 0) {
+        if ((SplatBitSize % BitWidth) == 0) {
           Constant = APInt::getAllOnesValue(BitWidth);
-          for (unsigned i = 0, n = SplatBitSize/BitWidth; i < n; ++i)
-            Constant &= SplatValue.lshr(i*BitWidth).zextOrTrunc(BitWidth);
+          for (unsigned i = 0, n = (SplatBitSize / BitWidth); i < n; ++i)
+            Constant &= SplatValue.extractBits(BitWidth, i * BitWidth);
         }
       }
     }