[llvm] r369839 - [InstCombine][NFC] reuse-constant-from-select-in-icmp.ll - revisit tests
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 23 23:49:11 PDT 2019
Author: lebedevri
Date: Fri Aug 23 23:49:11 2019
New Revision: 369839
URL: http://llvm.org/viewvc/llvm-project?rev=369839&view=rev
Log:
[InstCombine][NFC] reuse-constant-from-select-in-icmp.ll - revisit tests
Modified:
llvm/trunk/test/Transforms/InstCombine/reuse-constant-from-select-in-icmp.ll
Modified: llvm/trunk/test/Transforms/InstCombine/reuse-constant-from-select-in-icmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/reuse-constant-from-select-in-icmp.ll?rev=369839&r1=369838&r2=369839&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/reuse-constant-from-select-in-icmp.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/reuse-constant-from-select-in-icmp.ll Fri Aug 23 23:49:11 2019
@@ -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 %
%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) {
More information about the llvm-commits
mailing list