Surprisingly, we missed a trivial case here. Fix that!

llvm-svn: 164814
This commit is contained in:
Nick Lewycky 2012-09-28 09:33:53 +00:00
parent a320f275b7
commit 689f61680b
2 changed files with 12 additions and 0 deletions

View File

@ -930,6 +930,10 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
Value *V = Builder->CreateShuffleVector(TrueVal, FalseVal, MaskVal);
return ReplaceInstUsesWith(SI, V);
}
if (isa<ConstantAggregateZero>(CondVal)) {
return ReplaceInstUsesWith(SI, FalseVal);
}
}
return 0;

View File

@ -188,3 +188,11 @@ define <4 x i16> @test13d(<4 x i16> %lhs, <4 x i16> %rhs) {
<4 x i16> %lhs, <4 x i16> %rhs
ret <4 x i16> %A
}
define <4 x i16> @test13e(<4 x i16> %lhs, <4 x i16> %rhs) {
; CHECK: @test13e
; CHECK-NEXT: ret <4 x i16> %rhs
%A = select <4 x i1> <i1 false, i1 false, i1 false, i1 false>,
<4 x i16> %lhs, <4 x i16> %rhs
ret <4 x i16> %A
}