[llvm] r296353 - [X86] Fix SmallVector sizes in constant pool shuffle decoding to avoid heap allocation

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 27 08:15:28 PST 2017


Author: ctopper
Date: Mon Feb 27 10:15:27 2017
New Revision: 296353

URL: http://llvm.org/viewvc/llvm-project?rev=296353&view=rev
Log:
[X86] Fix SmallVector sizes in constant pool shuffle decoding to avoid heap allocation

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

Differential Revision: https://reviews.llvm.org/D30387

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

Modified: llvm/trunk/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp?rev=296353&r1=296352&r2=296353&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp Mon Feb 27 10:15:27 2017
@@ -104,7 +104,7 @@ void DecodePSHUFBMask(const Constant *C,
 
   // The shuffle mask requires a byte vector.
   APInt UndefElts;
-  SmallVector<uint64_t, 32> RawMask;
+  SmallVector<uint64_t, 64> RawMask;
   if (!extractConstantMask(C, 8, UndefElts, RawMask))
     return;
 
@@ -145,7 +145,7 @@ void DecodeVPERMILPMask(const Constant *
 
   // The shuffle mask requires elements the same size as the target.
   APInt UndefElts;
-  SmallVector<uint64_t, 8> RawMask;
+  SmallVector<uint64_t, 16> RawMask;
   if (!extractConstantMask(C, ElSize, UndefElts, RawMask))
     return;
 
@@ -231,7 +231,7 @@ void DecodeVPPERMMask(const Constant *C,
 
   // The shuffle mask requires a byte vector.
   APInt UndefElts;
-  SmallVector<uint64_t, 32> RawMask;
+  SmallVector<uint64_t, 16> RawMask;
   if (!extractConstantMask(C, 8, UndefElts, RawMask))
     return;
 
@@ -286,7 +286,7 @@ void DecodeVPERMVMask(const Constant *C,
 
   // The shuffle mask requires elements the same size as the target.
   APInt UndefElts;
-  SmallVector<uint64_t, 8> RawMask;
+  SmallVector<uint64_t, 64> RawMask;
   if (!extractConstantMask(C, ElSize, UndefElts, RawMask))
     return;
 
@@ -314,7 +314,7 @@ void DecodeVPERMV3Mask(const Constant *C
 
   // The shuffle mask requires elements the same size as the target.
   APInt UndefElts;
-  SmallVector<uint64_t, 8> RawMask;
+  SmallVector<uint64_t, 64> RawMask;
   if (!extractConstantMask(C, ElSize, UndefElts, RawMask))
     return;
 




More information about the llvm-commits mailing list