1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -instcombine -S | FileCheck %s
3 ; Verify that the non-default calling conv doesn't prevent the libcall simplification
5 @.str = private unnamed_addr constant [4 x i8] c"abc\00", align 1
7 define arm_aapcscc i32 @_abs(i32 %i) nounwind readnone {
9 ; CHECK-NEXT: [[TMP1:%.*]] = icmp slt i32 [[I:%.*]], 0
10 ; CHECK-NEXT: [[NEG:%.*]] = sub nsw i32 0, [[I]]
11 ; CHECK-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 [[NEG]], i32 [[I]]
12 ; CHECK-NEXT: ret i32 [[TMP2]]
14 %call = tail call arm_aapcscc i32 @abs(i32 %i) nounwind readnone
18 declare arm_aapcscc i32 @abs(i32) nounwind readnone
20 define arm_aapcscc i32 @_labs(i32 %i) nounwind readnone {
21 ; CHECK-LABEL: @_labs(
22 ; CHECK-NEXT: [[TMP1:%.*]] = icmp slt i32 [[I:%.*]], 0
23 ; CHECK-NEXT: [[NEG:%.*]] = sub nsw i32 0, [[I]]
24 ; CHECK-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 [[NEG]], i32 [[I]]
25 ; CHECK-NEXT: ret i32 [[TMP2]]
27 %call = tail call arm_aapcscc i32 @labs(i32 %i) nounwind readnone
31 declare arm_aapcscc i32 @labs(i32) nounwind readnone
33 define arm_aapcscc i32 @_strlen1() {
34 ; CHECK-LABEL: @_strlen1(
35 ; CHECK-NEXT: ret i32 3
37 %call = tail call arm_aapcscc i32 @strlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0))
41 declare arm_aapcscc i32 @strlen(i8*)
43 define arm_aapcscc zeroext i1 @_strlen2(i8* %str) {
44 ; CHECK-LABEL: @_strlen2(
45 ; CHECK-NEXT: [[STRLENFIRST:%.*]] = load i8, i8* [[STR:%.*]], align 1
46 ; CHECK-NEXT: [[CMP:%.*]] = icmp ne i8 [[STRLENFIRST]], 0
47 ; CHECK-NEXT: ret i1 [[CMP]]
49 %call = tail call arm_aapcscc i32 @strlen(i8* %str)
50 %cmp = icmp ne i32 %call, 0