diff options
author | Joey Gouly <joey.gouly@arm.com> | 2013-07-12 23:08:06 +0000 |
---|---|---|
committer | Joey Gouly <joey.gouly@arm.com> | 2013-07-12 23:08:06 +0000 |
commit | ebe11477225cc2793b43073bddc17f484839e006 (patch) | |
tree | 7c1d2eec791522d800dbdfa9d8daec21d2c8ebea | |
parent | ae24f7d3c6770fb32eb1f6215bab1fc92cbe2d94 (diff) | |
download | external_llvm-ebe11477225cc2793b43073bddc17f484839e006.zip external_llvm-ebe11477225cc2793b43073bddc17f484839e006.tar.gz external_llvm-ebe11477225cc2793b43073bddc17f484839e006.tar.bz2 |
Fix a crash in EvaluateInDifferentElementOrder where it would generate an
undef vector of the wrong type.
LGTM'd by Nick Lewycky on IRC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186224 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineVectorOps.cpp | 4 | ||||
-rw-r--r-- | test/Transforms/InstCombine/vec_shuffle.ll | 15 |
2 files changed, 18 insertions, 1 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/lib/Transforms/InstCombine/InstCombineVectorOps.cpp index d43093d..f3de6e2 100644 --- a/lib/Transforms/InstCombine/InstCombineVectorOps.cpp +++ b/lib/Transforms/InstCombine/InstCombineVectorOps.cpp @@ -732,7 +732,9 @@ InstCombiner::EvaluateInDifferentElementOrder(Value *V, ArrayRef<int> Mask) { } if (!Found) - return UndefValue::get(I->getType()); + return UndefValue::get( + VectorType::get(V->getType()->getScalarType(), Mask.size())); + Value *V = EvaluateInDifferentElementOrder(I->getOperand(0), Mask); return InsertElementInst::Create(V, I->getOperand(1), Builder->getInt32(Index), "", I); diff --git a/test/Transforms/InstCombine/vec_shuffle.ll b/test/Transforms/InstCombine/vec_shuffle.ll index 5ffe6c0..2adc1c9 100644 --- a/test/Transforms/InstCombine/vec_shuffle.ll +++ b/test/Transforms/InstCombine/vec_shuffle.ll @@ -185,3 +185,18 @@ define <2 x i8> @test13c(i8 %x1, i8 %x2) { %C = shufflevector <4 x i8> %B, <4 x i8> undef, <2 x i32> <i32 0, i32 2> ret <2 x i8> %C } + +define void @test14(i16 %conv10) { + %tmp = alloca <4 x i16>, align 8 + %vecinit6 = insertelement <4 x i16> undef, i16 23, i32 3 + store <4 x i16> %vecinit6, <4 x i16>* undef + %tmp1 = load <4 x i16>* undef + %vecinit11 = insertelement <4 x i16> undef, i16 %conv10, i32 3 + %div = udiv <4 x i16> %tmp1, %vecinit11 + store <4 x i16> %div, <4 x i16>* %tmp + %tmp4 = load <4 x i16>* %tmp + %tmp5 = shufflevector <4 x i16> %tmp4, <4 x i16> undef, <2 x i32> <i32 2, i32 0> + %cmp = icmp ule <2 x i16> %tmp5, undef + %sext = sext <2 x i1> %cmp to <2 x i16> + ret void +} |