[PATCH] D30387: [X86] Fix SmallVector sizes in constant pool shuffle decoding to avoid heap allocation

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 26 18:28:44 PST 2017


craig.topper created this revision.

Some of the vectors are under sized to avoid heap allocation. In one case the vector was oversized.

Not sure if 64 uint64_ts is maybe too much stack space.


https://reviews.llvm.org/D30387

Files:
  lib/Target/X86/X86ShuffleDecodeConstantPool.cpp


Index: lib/Target/X86/X86ShuffleDecodeConstantPool.cpp
===================================================================
--- lib/Target/X86/X86ShuffleDecodeConstantPool.cpp
+++ lib/Target/X86/X86ShuffleDecodeConstantPool.cpp
@@ -104,7 +104,7 @@
 
   // The shuffle mask requires a byte vector.
   SmallBitVector UndefElts;
-  SmallVector<uint64_t, 32> RawMask;
+  SmallVector<uint64_t, 64> RawMask;
   if (!extractConstantMask(C, 8, UndefElts, RawMask))
     return;
 
@@ -145,7 +145,7 @@
 
   // The shuffle mask requires elements the same size as the target.
   SmallBitVector UndefElts;
-  SmallVector<uint64_t, 8> RawMask;
+  SmallVector<uint64_t, 16> RawMask;
   if (!extractConstantMask(C, ElSize, UndefElts, RawMask))
     return;
 
@@ -231,7 +231,7 @@
 
   // The shuffle mask requires a byte vector.
   SmallBitVector UndefElts;
-  SmallVector<uint64_t, 32> RawMask;
+  SmallVector<uint64_t, 16> RawMask;
   if (!extractConstantMask(C, 8, UndefElts, RawMask))
     return;
 
@@ -286,7 +286,7 @@
 
   // The shuffle mask requires elements the same size as the target.
   SmallBitVector UndefElts;
-  SmallVector<uint64_t, 8> RawMask;
+  SmallVector<uint64_t, 64> RawMask;
   if (!extractConstantMask(C, ElSize, UndefElts, RawMask))
     return;
 
@@ -314,7 +314,7 @@
 
   // The shuffle mask requires elements the same size as the target.
   SmallBitVector UndefElts;
-  SmallVector<uint64_t, 8> RawMask;
+  SmallVector<uint64_t, 64> RawMask;
   if (!extractConstantMask(C, ElSize, UndefElts, RawMask))
     return;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30387.89827.patch
Type: text/x-patch
Size: 1528 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170227/c6d88dfb/attachment.bin>


More information about the llvm-commits mailing list