1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instcombine -S | FileCheck %s
4 define i32 @foo(i32 %a) {
6 ; CHECK-NEXT: [[T15:%.*]] = sub i32 99, [[A:%.*]]
7 ; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[T15]], i32 0)
8 ; CHECK-NEXT: [[T12:%.*]] = add i32 [[SMAX]], [[A]]
9 ; CHECK-NEXT: [[T13:%.*]] = add i32 [[T12]], 1
10 ; CHECK-NEXT: ret i32 [[T13]]
13 %t16 = icmp slt i32 %t15, 0
14 %smax = select i1 %t16, i32 0, i32 %t15
15 %t12 = add i32 %smax, %a
16 %t13 = add i32 %t12, 1
20 define i32 @bar(i32 %a) {
22 ; CHECK-NEXT: [[T15:%.*]] = sub i32 99, [[A:%.*]]
23 ; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[T15]], i32 0)
24 ; CHECK-NEXT: [[T12:%.*]] = add i32 [[SMAX]], [[A]]
25 ; CHECK-NEXT: ret i32 [[T12]]
28 %t16 = icmp slt i32 %t15, 0
29 %smax = select i1 %t16, i32 0, i32 %t15
30 %t12 = add i32 %smax, %a