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
5 ; Layout specifies type of pointer which determines "size_t"
6 ; which is used to identify libcalls such as "size_t strlen(char*)".
8 target datalayout = "p:32:32"
10 @.str = private unnamed_addr constant [4 x i8] c"abc\00", align 1
12 define arm_aapcscc i32 @_abs(i32 %i) nounwind readnone {
14 ; CHECK-NEXT: [[CALL:%.*]] = call i32 @llvm.abs.i32(i32 [[I:%.*]], i1 true)
15 ; CHECK-NEXT: ret i32 [[CALL]]
17 %call = tail call arm_aapcscc i32 @abs(i32 %i) nounwind readnone
21 declare arm_aapcscc i32 @abs(i32) nounwind readnone
23 define 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]]
28 %call = tail call arm_aapcscc i32 @labs(i32 %i) nounwind readnone
32 declare arm_aapcscc i32 @labs(i32) nounwind readnone
34 define arm_aapcscc i32 @_strlen1() {
35 ; CHECK-LABEL: @_strlen1(
36 ; CHECK-NEXT: ret i32 3
38 %call = tail call arm_aapcscc i32 @strlen(ptr @.str)
42 declare arm_aapcscc i32 @strlen(ptr)
44 define 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]]
50 %call = tail call arm_aapcscc i32 @strlen(ptr %str)
51 %cmp = icmp ne i32 %call, 0