]> granicus.if.org Git - llvm/commitdiff
[X86] Fix SmallVector sizes in constant pool shuffle decoding to avoid heap allocation
authorCraig Topper <craig.topper@gmail.com>
Mon, 27 Feb 2017 16:15:27 +0000 (16:15 +0000)
committerCraig Topper <craig.topper@gmail.com>
Mon, 27 Feb 2017 16:15:27 +0000 (16:15 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296353 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ShuffleDecodeConstantPool.cpp

index 3ce8609267fd28b84d1600cc3aba3bc2f93c776a..df6ddafa7171eec5a5cac447ceab9e2b130e0930 100644 (file)
@@ -104,7 +104,7 @@ void DecodePSHUFBMask(const Constant *C, SmallVectorImpl<int> &ShuffleMask) {
 
   // 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 *C, unsigned ElSize,
 
   // 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, SmallVectorImpl<int> &ShuffleMask) {
 
   // 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, unsigned ElSize,
 
   // 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, unsigned ElSize,
 
   // 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;