1 ; RUN: opt -S -passes=callsite-splitting -callsite-splitting-duplication-threshold=100000000 < %s | FileCheck -enable-var-scope %s
3 ; Noduplicate calls should not be duplicated
4 ; CHECK-LABEL: define void @noduplicate_caller(
5 ; CHECK: call void @noduplicate_callee(
6 ; CHECK-NOT: call void @noduplicate_callee(
7 define void @noduplicate_caller(i1 %c, ptr %a_elt, ptr %b_elt) #0 {
12 %tobool1 = icmp eq ptr %a_elt, null
13 br i1 %tobool1, label %CallSiteBB, label %NextCond
16 %cmp = icmp ne ptr %b_elt, null
17 br i1 %cmp, label %CallSiteBB, label %End
20 %p = phi i1 [ false, %Top ], [ %c, %NextCond ]
21 call void @noduplicate_callee(ptr %a_elt, i1 %p)
28 ; CHECK-LABEL: define void @noduplicate_callee(
29 ; CHECK: call void @noduplicate_external(
30 ; CHECK-NOT: call void @noduplicate_external(
31 define void @noduplicate_callee(ptr %a_elt, i1 %c) #0 {
33 %tobool = icmp ne ptr %a_elt, null
34 br i1 %tobool, label %then, label %endif
40 call void @noduplicate_external(ptr %a_elt) #0
44 ; Make sure an otherwise identical function is transformed
45 ; CHECK-LABEL: define void @reference_caller(
46 ; CHECK: call void @nonnoduplicate_callee(
47 ; CHECK: call void @nonnoduplicate_callee(
48 define void @reference_caller(i1 %c, ptr %a_elt, ptr %b_elt) #1 {
53 %tobool1 = icmp eq ptr %a_elt, null
54 br i1 %tobool1, label %CallSiteBB, label %NextCond
57 %cmp = icmp ne ptr %b_elt, null
58 br i1 %cmp, label %CallSiteBB, label %End
61 %p = phi i1 [ false, %Top ], [ %c, %NextCond ]
62 call void @nonnoduplicate_callee(ptr %a_elt, i1 %p)
69 ; CHECK-LABEL: define void @nonnoduplicate_callee(
70 ; CHECK: call void @nonnoduplicate_external(
71 ; CHECK-NOT: call void @nonnoduplicate_external(
72 define void @nonnoduplicate_callee(ptr %a_elt, i1 %c) #1 {
74 %tobool = icmp ne ptr %a_elt, null
75 br i1 %tobool, label %then, label %endif
81 call void @nonnoduplicate_external(ptr %a_elt)
85 declare void @noduplicate_external(ptr) #0
86 declare void @nonnoduplicate_external(ptr) #1
88 attributes #0 = { noduplicate nounwind }
89 attributes #1 = { nounwind }