[llvm] 6fa6000 - [DAG] DAGCombiner::XformToShuffleWithZero - use APInt::extractBits helper. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 6 05:17:18 PST 2020


Author: Simon Pilgrim
Date: 2020-01-06T13:17:02Z
New Revision: 6fa6000e3e2bb582c6a8509c34b52ecd44fbf625

URL: https://github.com/llvm/llvm-project/commit/6fa6000e3e2bb582c6a8509c34b52ecd44fbf625
DIFF: https://github.com/llvm/llvm-project/commit/6fa6000e3e2bb582c6a8509c34b52ecd44fbf625.diff

LOG: [DAG] DAGCombiner::XformToShuffleWithZero - use APInt::extractBits helper. NFCI.

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 611ea782aa74..eba7d695c770 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -19786,14 +19786,10 @@ SDValue DAGCombiner::XformToShuffleWithZero(SDNode *N) {
         return SDValue();
 
       // Extract the sub element from the constant bit mask.
-      if (DAG.getDataLayout().isBigEndian()) {
-        Bits.lshrInPlace((Split - SubIdx - 1) * NumSubBits);
-      } else {
-        Bits.lshrInPlace(SubIdx * NumSubBits);
-      }
-
-      if (Split > 1)
-        Bits = Bits.trunc(NumSubBits);
+      if (DAG.getDataLayout().isBigEndian())
+        Bits = Bits.extractBits(NumSubBits, (Split - SubIdx - 1) * NumSubBits);
+      else
+        Bits = Bits.extractBits(NumSubBits, SubIdx * NumSubBits);
 
       if (Bits.isAllOnesValue())
         Indices.push_back(i);


        


More information about the llvm-commits mailing list