1 ; RUN: opt -S -callsite-splitting -callsite-splitting-duplication-threshold=100000000 < %s | FileCheck -enable-var-scope %s
2 ; RUN: opt -S -callsite-splitting -callsite-splitting-duplication-threshold=100000000 < %s | FileCheck -enable-var-scope %s
4 ; Noduplicate calls should not be duplicated
5 ; CHECK-LABEL: define void @noduplicate_caller(
6 ; CHECK: call void @noduplicate_callee(
7 ; CHECK-NOT: call void @noduplicate_callee(
8 define void @noduplicate_caller(i1 %c, i8* %a_elt, i8* %b_elt) #0 {
13 %tobool1 = icmp eq i8* %a_elt, null
14 br i1 %tobool1, label %CallSiteBB, label %NextCond
17 %cmp = icmp ne i8* %b_elt, null
18 br i1 %cmp, label %CallSiteBB, label %End
21 %p = phi i1 [ false, %Top ], [ %c, %NextCond ]
22 call void @noduplicate_callee(i8* %a_elt, i1 %p)
29 ; CHECK-LABEL: define void @noduplicate_callee(
30 ; CHECK: call void @noduplicate_external(
31 ; CHECK-NOT: call void @noduplicate_external(
32 define void @noduplicate_callee(i8* %a_elt, i1 %c) #0 {
34 %tobool = icmp ne i8* %a_elt, null
35 br i1 %tobool, label %then, label %endif
41 call void @noduplicate_external(i8* %a_elt) #0
45 ; Make sure an otherwise identical function is transformed
46 ; CHECK-LABEL: define void @reference_caller(
47 ; CHECK: call void @nonnoduplicate_callee(
48 ; CHECK: call void @nonnoduplicate_callee(
49 define void @reference_caller(i1 %c, i8* %a_elt, i8* %b_elt) #1 {
54 %tobool1 = icmp eq i8* %a_elt, null
55 br i1 %tobool1, label %CallSiteBB, label %NextCond
58 %cmp = icmp ne i8* %b_elt, null
59 br i1 %cmp, label %CallSiteBB, label %End
62 %p = phi i1 [ false, %Top ], [ %c, %NextCond ]
63 call void @nonnoduplicate_callee(i8* %a_elt, i1 %p)
70 ; CHECK-LABEL: define void @nonnoduplicate_callee(
71 ; CHECK: call void @nonnoduplicate_external(
72 ; CHECK-NOT: call void @nonnoduplicate_external(
73 define void @nonnoduplicate_callee(i8* %a_elt, i1 %c) #1 {
75 %tobool = icmp ne i8* %a_elt, null
76 br i1 %tobool, label %then, label %endif
82 call void @nonnoduplicate_external(i8* %a_elt)
86 declare void @noduplicate_external(i8*) #0
87 declare void @nonnoduplicate_external(i8*) #1
89 attributes #0 = { noduplicate nounwind }
90 attributes #1 = { nounwind }