1 ; RUN: opt < %s -callsite-splitting -verify-dom-info -S | FileCheck %s
4 ;CHECK-LABEL: Top.split:
5 ;CHECK: %ca1 = musttail call i8* @callee(i8* null, i8* %b)
6 ;CHECK: %cb2 = bitcast i8* %ca1 to i8*
8 ;CHECK-LABEL: TBB.split
9 ;CHECK: %ca3 = musttail call i8* @callee(i8* nonnull %a, i8* null)
10 ;CHECK: %cb4 = bitcast i8* %ca3 to i8*
12 define i8* @caller(i8* %a, i8* %b) {
14 %c = icmp eq i8* %a, null
15 br i1 %c, label %Tail, label %TBB
17 %c2 = icmp eq i8* %b, null
18 br i1 %c2, label %Tail, label %End
20 %ca = musttail call i8* @callee(i8* %a, i8* %b)
21 %cb = bitcast i8* %ca to i8*
27 define i8* @callee(i8* %a, i8* %b) noinline {
31 ;CHECK-LABEL: @no_cast_caller
32 ;CHECK-LABEL: Top.split:
33 ;CHECK: %ca1 = musttail call i8* @callee(i8* null, i8* %b)
35 ;CHECK-LABEL: TBB.split
36 ;CHECK: %ca2 = musttail call i8* @callee(i8* nonnull %a, i8* null)
38 define i8* @no_cast_caller(i8* %a, i8* %b) {
40 %c = icmp eq i8* %a, null
41 br i1 %c, label %Tail, label %TBB
43 %c2 = icmp eq i8* %b, null
44 br i1 %c2, label %Tail, label %End
46 %ca = musttail call i8* @callee(i8* %a, i8* %b)
52 ;CHECK-LABEL: @void_caller
53 ;CHECK-LABEL: Top.split:
54 ;CHECK: musttail call void @void_callee(i8* null, i8* %b)
56 ;CHECK-LABEL: TBB.split
57 ;CHECK: musttail call void @void_callee(i8* nonnull %a, i8* null)
59 define void @void_caller(i8* %a, i8* %b) {
61 %c = icmp eq i8* %a, null
62 br i1 %c, label %Tail, label %TBB
64 %c2 = icmp eq i8* %b, null
65 br i1 %c2, label %Tail, label %End
67 musttail call void @void_callee(i8* %a, i8* %b)
73 define void @void_callee(i8* %a, i8* %b) noinline {
77 ; Include a test with a larger CFG that exercises the DomTreeUpdater
78 ; machinery a bit more.
79 ;CHECK-LABEL: @larger_cfg_caller
80 ;CHECK-LABEL: Top.split:
81 ;CHECK: %r1 = musttail call i8* @callee(i8* null, i8* %b)
83 ;CHECK-LABEL: TBB.split
84 ;CHECK: %r2 = musttail call i8* @callee(i8* nonnull %a, i8* null)
86 define i8* @larger_cfg_caller(i8* %a, i8* %b) {
88 %cond1 = icmp eq i8* %a, null
89 br i1 %cond1, label %Tail, label %ExtraTest
92 %cond2 = icmp eq i8 %a0, 0
93 br i1 %cond2, label %TBB_pred, label %End
97 %cond3 = icmp eq i8* %b, null
98 br i1 %cond3, label %Tail, label %End
100 %r = musttail call i8* @callee(i8* %a, i8* %b)