From 8ed88ee72ca48a1f9ce0b43efc1c1739ff38db42 Mon Sep 17 00:00:00 2001 From: Roman Lebedev Date: Sat, 24 Aug 2019 06:49:11 +0000 Subject: [PATCH] [InstCombine][NFC] reuse-constant-from-select-in-icmp.ll - revisit tests git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369839 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../reuse-constant-from-select-in-icmp.ll | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/test/Transforms/InstCombine/reuse-constant-from-select-in-icmp.ll b/test/Transforms/InstCombine/reuse-constant-from-select-in-icmp.ll index 7128922df74..5964c02228c 100644 --- a/test/Transforms/InstCombine/reuse-constant-from-select-in-icmp.ll +++ b/test/Transforms/InstCombine/reuse-constant-from-select-in-icmp.ll @@ -263,9 +263,9 @@ define i32 @n21_equality(i32 %x, i32 %y) { ret i32 %r } -; We don't touch sign checks -define i32 @n22_sign_check(i32 %x, i32 %y) { -; CHECK-LABEL: @n22_sign_check( +; There is nothing special about sign-bit-tests, we can fold them. +define i32 @t22_sign_check(i32 %x, i32 %y) { +; CHECK-LABEL: @t22_sign_check( ; CHECK-NEXT: [[T:%.*]] = icmp slt i32 [[X:%.*]], 0 ; CHECK-NEXT: [[R:%.*]] = select i1 [[T]], i32 -1, i32 [[Y:%.*]] ; CHECK-NEXT: ret i32 [[R]] @@ -274,6 +274,16 @@ define i32 @n22_sign_check(i32 %x, i32 %y) { %r = select i1 %t, i32 -1, i32 %y ret i32 %r } +define i32 @t22_sign_check2(i32 %x, i32 %y) { +; CHECK-LABEL: @t22_sign_check2( +; CHECK-NEXT: [[T:%.*]] = icmp sgt i32 [[X:%.*]], -1 +; CHECK-NEXT: [[R:%.*]] = select i1 [[T]], i32 0, i32 [[Y:%.*]] +; CHECK-NEXT: ret i32 [[R]] +; + %t = icmp sgt i32 %x, -1 + %r = select i1 %t, i32 0, i32 %y + ret i32 %r +} ; If the types don't match we currently don't do anything. define i32 @n23_type_mismatch(i64 %x, i32 %y) { -- 2.50.1