diff --git a/lib/Transforms/InstCombine/InstructionCombining.cpp b/lib/Transforms/InstCombine/InstructionCombining.cpp index 90ca8863e8c..8c0a249aee1 100644 --- a/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -1125,7 +1125,7 @@ Value *InstCombiner::SimplifyVectorOp(BinaryOperator &Inst) { BinaryOperator *NewBO = CreateBinOpAsGiven(Inst, LShuf->getOperand(0), RShuf->getOperand(0), Builder); Value *Res = Builder->CreateShuffleVector(NewBO, - UndefValue::get(Inst.getType()), LShuf->getMask()); + UndefValue::get(NewBO->getType()), LShuf->getMask()); return Res; } } diff --git a/test/Transforms/InstCombine/vec_shuffle.ll b/test/Transforms/InstCombine/vec_shuffle.ll index 79377a18765..a3f7f79624d 100644 --- a/test/Transforms/InstCombine/vec_shuffle.ll +++ b/test/Transforms/InstCombine/vec_shuffle.ll @@ -375,3 +375,14 @@ define <2 x i32> @pr19717(<4 x i32> %in0, <2 x i32> %in1) { %mul = mul <2 x i32> %shuffle, %shuffle4 ret <2 x i32> %mul } + +define <4 x i16> @pr19717a(<8 x i16> %in0, <8 x i16> %in1) { +; CHECK-LABEL: @pr19717a( +; CHECK: [[VAR1:%[a-zA-Z0-9.]+]] = mul <8 x i16> %in0, %in1 +; CHECK: [[VAR2:%[a-zA-Z0-9.]+]] = shufflevector <8 x i16> [[VAR1]], <8 x i16> undef, <4 x i32> +; CHECK: ret <4 x i16> [[VAR2]] + %shuffle = shufflevector <8 x i16> %in0, <8 x i16> %in0, <4 x i32> + %shuffle1 = shufflevector <8 x i16> %in1, <8 x i16> %in1, <4 x i32> + %mul = mul <4 x i16> %shuffle, %shuffle1 + ret <4 x i16> %mul +}