Index: lib/Analysis/InstructionSimplify.cpp =================================================================== --- lib/Analysis/InstructionSimplify.cpp +++ lib/Analysis/InstructionSimplify.cpp @@ -3580,6 +3580,9 @@ // select true, X, Y -> X // select false, X, Y -> Y if (Constant *CB = dyn_cast(CondVal)) { + if (Constant *CT = dyn_cast(TrueVal)) + if (Constant *CF = dyn_cast(FalseVal)) + return ConstantExpr::getSelect(CB, CT, CF); if (CB->isAllOnesValue()) return TrueVal; if (CB->isNullValue()) Index: test/Transforms/InstSimplify/select.ll =================================================================== --- test/Transforms/InstSimplify/select.ll +++ test/Transforms/InstSimplify/select.ll @@ -17,6 +17,14 @@ ret <2 x i8> %s } +define <2 x i8> @vsel_mixedvec() { +; CHECK-LABEL: @vsel_mixedvec( +; CHECK-NEXT: ret <2 x i8> +; + %s = select <2 x i1>, <2 x i8> , <2 x i8> + ret <2 x i8> %s +} + define i32 @test1(i32 %x) { ; CHECK-LABEL: @test1( ; CHECK-NEXT: ret i32 %x