Fix a crash in EvaluateInDifferentElementOrder where it would generate an

undef vector of the wrong type.

LGTM'd by Nick Lewycky on IRC.

llvm-svn: 186224
This commit is contained in:
Joey Gouly 2013-07-12 23:08:06 +00:00
parent 3deb0e7ca5
commit a3250f22c2
2 changed files with 18 additions and 1 deletions

View File

@ -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);

View File

@ -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
}