From: Nick Lewycky Date: Fri, 28 Sep 2012 09:33:53 +0000 (+0000) Subject: Surprisingly, we missed a trivial case here. Fix that! X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=156999f8b9cee34f2c0fd516f8d3050060ad2c14;p=platform%2Fupstream%2Fllvm.git Surprisingly, we missed a trivial case here. Fix that! llvm-svn: 164814 --- diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp index 70483ce..0ba7340 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp @@ -930,6 +930,10 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) { Value *V = Builder->CreateShuffleVector(TrueVal, FalseVal, MaskVal); return ReplaceInstUsesWith(SI, V); } + + if (isa(CondVal)) { + return ReplaceInstUsesWith(SI, FalseVal); + } } return 0; diff --git a/llvm/test/Transforms/InstCombine/vec_shuffle.ll b/llvm/test/Transforms/InstCombine/vec_shuffle.ll index a7f9fcf..14f5321 100644 --- a/llvm/test/Transforms/InstCombine/vec_shuffle.ll +++ b/llvm/test/Transforms/InstCombine/vec_shuffle.ll @@ -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> , + <4 x i16> %lhs, <4 x i16> %rhs + ret <4 x i16> %A +}