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 4 5@.str = private unnamed_addr constant [4 x i8] c"abc\00", align 1 6 7define arm_aapcscc i32 @_abs(i32 %i) nounwind readnone { 8; CHECK-LABEL: @_abs( 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]] 13; 14 %call = tail call arm_aapcscc i32 @abs(i32 %i) nounwind readnone 15 ret i32 %call 16} 17 18declare arm_aapcscc i32 @abs(i32) nounwind readnone 19 20define 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]] 26; 27 %call = tail call arm_aapcscc i32 @labs(i32 %i) nounwind readnone 28 ret i32 %call 29} 30 31declare arm_aapcscc i32 @labs(i32) nounwind readnone 32 33define arm_aapcscc i32 @_strlen1() { 34; CHECK-LABEL: @_strlen1( 35; CHECK-NEXT: ret i32 3 36; 37 %call = tail call arm_aapcscc i32 @strlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0)) 38 ret i32 %call 39} 40 41declare arm_aapcscc i32 @strlen(i8*) 42 43define 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]] 48; 49 %call = tail call arm_aapcscc i32 @strlen(i8* %str) 50 %cmp = icmp ne i32 %call, 0 51 ret i1 %cmp 52} 53 54