1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt < %s -passes=instcombine -S | FileCheck %s 3; Verify that the non-default calling conv doesn't prevent the libcall simplification 4 5; Layout specifies type of pointer which determines "size_t" 6; which is used to identify libcalls such as "size_t strlen(char*)". 7 8target datalayout = "p:32:32" 9 10@.str = private unnamed_addr constant [4 x i8] c"abc\00", align 1 11 12define arm_aapcscc i32 @_abs(i32 %i) nounwind readnone { 13; CHECK-LABEL: @_abs( 14; CHECK-NEXT: [[CALL:%.*]] = call i32 @llvm.abs.i32(i32 [[I:%.*]], i1 true) 15; CHECK-NEXT: ret i32 [[CALL]] 16; 17 %call = tail call arm_aapcscc i32 @abs(i32 %i) nounwind readnone 18 ret i32 %call 19} 20 21declare arm_aapcscc i32 @abs(i32) nounwind readnone 22 23define arm_aapcscc i32 @_labs(i32 %i) nounwind readnone { 24; CHECK-LABEL: @_labs( 25; CHECK-NEXT: [[CALL:%.*]] = call i32 @llvm.abs.i32(i32 [[I:%.*]], i1 true) 26; CHECK-NEXT: ret i32 [[CALL]] 27; 28 %call = tail call arm_aapcscc i32 @labs(i32 %i) nounwind readnone 29 ret i32 %call 30} 31 32declare arm_aapcscc i32 @labs(i32) nounwind readnone 33 34define arm_aapcscc i32 @_strlen1() { 35; CHECK-LABEL: @_strlen1( 36; CHECK-NEXT: ret i32 3 37; 38 %call = tail call arm_aapcscc i32 @strlen(ptr @.str) 39 ret i32 %call 40} 41 42declare arm_aapcscc i32 @strlen(ptr) 43 44define arm_aapcscc zeroext i1 @_strlen2(ptr %str) { 45; CHECK-LABEL: @_strlen2( 46; CHECK-NEXT: [[CHAR0:%.*]] = load i8, ptr [[STR:%.*]], align 1 47; CHECK-NEXT: [[CMP:%.*]] = icmp ne i8 [[CHAR0]], 0 48; CHECK-NEXT: ret i1 [[CMP]] 49; 50 %call = tail call arm_aapcscc i32 @strlen(ptr %str) 51 %cmp = icmp ne i32 %call, 0 52 ret i1 %cmp 53} 54 55