]> granicus.if.org Git - llvm/commitdiff
[InstCombine] Add a test case for a missed opportunity to turn a select into logic...
authorCraig Topper <craig.topper@intel.com>
Wed, 9 Aug 2017 01:30:22 +0000 (01:30 +0000)
committerCraig Topper <craig.topper@intel.com>
Wed, 9 Aug 2017 01:30:22 +0000 (01:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310434 91177308-0d34-0410-b5e6-96231b3b80d8

test/Transforms/InstCombine/select-with-bitwise-ops.ll

index 24e5f25701ab8547beb3708d0de8170ac3d16aad..39912c9c09dbf55b8532c8350cc57636ae821ab4 100644 (file)
@@ -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