[PATCH] D30386: [X86] Use APInt instead of SmallBitVector for tracking undef elements in constant pool shuffle decoding

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 27 08:27:23 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL296352: [X86] Use APInt instead of SmallBitVector for tracking undef elements in… (authored by ctopper).

Changed prior to commit:
  https://reviews.llvm.org/D30386?vs=89826&id=89885#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30386

Files:
  llvm/trunk/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp


Index: llvm/trunk/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp
===================================================================
--- llvm/trunk/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp
+++ llvm/trunk/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp
@@ -14,7 +14,7 @@
 
 #include "X86ShuffleDecodeConstantPool.h"
 #include "Utils/X86ShuffleDecode.h"
-#include "llvm/ADT/SmallBitVector.h"
+#include "llvm/ADT/APInt.h"
 #include "llvm/CodeGen/MachineValueType.h"
 #include "llvm/IR/Constants.h"
 
@@ -25,7 +25,7 @@
 namespace llvm {
 
 static bool extractConstantMask(const Constant *C, unsigned MaskEltSizeInBits,
-                                SmallBitVector &UndefElts,
+                                APInt &UndefElts,
                                 SmallVectorImpl<uint64_t> &RawMask) {
   // It is not an error for shuffle masks to not be a vector of
   // MaskEltSizeInBits because the constant pool uniques constants by their
@@ -73,7 +73,7 @@
          "Unaligned shuffle mask size");
 
   unsigned NumMaskElts = CstSizeInBits / MaskEltSizeInBits;
-  UndefElts = SmallBitVector(NumMaskElts, false);
+  UndefElts = APInt(NumMaskElts, 0);
   RawMask.resize(NumMaskElts, 0);
 
   for (unsigned i = 0; i != NumMaskElts; ++i) {
@@ -83,7 +83,7 @@
     // Only treat the element as UNDEF if all bits are UNDEF, otherwise
     // treat it as zero.
     if (EltUndef.isAllOnesValue()) {
-      UndefElts[i] = true;
+      UndefElts.setBit(i);
       RawMask[i] = 0;
       continue;
     }
@@ -103,7 +103,7 @@
          "Unexpected vector size.");
 
   // The shuffle mask requires a byte vector.
-  SmallBitVector UndefElts;
+  APInt UndefElts;
   SmallVector<uint64_t, 32> RawMask;
   if (!extractConstantMask(C, 8, UndefElts, RawMask))
     return;
@@ -144,7 +144,7 @@
   assert((ElSize == 32 || ElSize == 64) && "Unexpected vector element size.");
 
   // The shuffle mask requires elements the same size as the target.
-  SmallBitVector UndefElts;
+  APInt UndefElts;
   SmallVector<uint64_t, 8> RawMask;
   if (!extractConstantMask(C, ElSize, UndefElts, RawMask))
     return;
@@ -179,7 +179,7 @@
   assert((MaskTySize == 128 || MaskTySize == 256) && "Unexpected vector size.");
 
   // The shuffle mask requires elements the same size as the target.
-  SmallBitVector UndefElts;
+  APInt UndefElts;
   SmallVector<uint64_t, 8> RawMask;
   if (!extractConstantMask(C, ElSize, UndefElts, RawMask))
     return;
@@ -230,7 +230,7 @@
          "Unexpected vector size.");
 
   // The shuffle mask requires a byte vector.
-  SmallBitVector UndefElts;
+  APInt UndefElts;
   SmallVector<uint64_t, 32> RawMask;
   if (!extractConstantMask(C, 8, UndefElts, RawMask))
     return;
@@ -285,7 +285,7 @@
          "Unexpected vector element size.");
 
   // The shuffle mask requires elements the same size as the target.
-  SmallBitVector UndefElts;
+  APInt UndefElts;
   SmallVector<uint64_t, 8> RawMask;
   if (!extractConstantMask(C, ElSize, UndefElts, RawMask))
     return;
@@ -313,7 +313,7 @@
          "Unexpected vector element size.");
 
   // The shuffle mask requires elements the same size as the target.
-  SmallBitVector UndefElts;
+  APInt UndefElts;
   SmallVector<uint64_t, 8> RawMask;
   if (!extractConstantMask(C, ElSize, UndefElts, RawMask))
     return;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30386.89885.patch
Type: text/x-patch
Size: 3285 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170227/89d103b7/attachment.bin>


More information about the llvm-commits mailing list