From: Craig Topper Date: Wed, 9 Aug 2017 01:30:22 +0000 (+0000) Subject: [InstCombine] Add a test case for a missed opportunity to turn a select into logic... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=94b1780d8ae1fa3ad5b8e48f31b6f7a3c64f6982;p=llvm [InstCombine] Add a test case for a missed opportunity to turn a select into logic ops. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310434 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Transforms/InstCombine/select-with-bitwise-ops.ll b/test/Transforms/InstCombine/select-with-bitwise-ops.ll index 24e5f25701a..39912c9c09d 100644 --- a/test/Transforms/InstCombine/select-with-bitwise-ops.ll +++ b/test/Transforms/InstCombine/select-with-bitwise-ops.ll @@ -384,6 +384,20 @@ define i32 @test69(i32 %x, i32 %y) { ret i32 %select } +; TODO: we should be able to remove this select +define i8 @test70(i8 %x, i8 %y) { +; CHECK-LABEL: @test70( +; CHECK-NEXT: [[CMP:%.*]] = icmp slt i8 [[X:%.*]], 0 +; CHECK-NEXT: [[OR:%.*]] = or i8 [[Y:%.*]], 2 +; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], i8 [[OR]], i8 [[Y]] +; CHECK-NEXT: ret i8 [[SELECT]] +; + %cmp = icmp slt i8 %x, 0 + %or = or i8 %y, 2 + %select = select i1 %cmp, i8 %or, i8 %y + ret i8 %select +} + define i32 @shift_no_xor_multiuse_or(i32 %x, i32 %y) { ; CHECK-LABEL: @shift_no_xor_multiuse_or( ; CHECK-NEXT: [[OR:%.*]] = or i32 [[Y:%.*]], 2