1*cee313d2SEric Christopher; RUN: opt < %s -partial-inliner -skip-partial-inlining-cost-analysis -S | FileCheck %s
2*cee313d2SEric Christopher;
3*cee313d2SEric Christopher
4*cee313d2SEric Christopherdefine i32 @callee_indr_branch(i32 %v) {
5*cee313d2SEric Christopherentry:
6*cee313d2SEric Christopher  %cmp = icmp sgt i32 %v, 2000
7*cee313d2SEric Christopher  %addr = select i1 %cmp, i8* blockaddress(@callee_indr_branch, %if.then), i8* blockaddress(@callee_indr_branch, %if.end)
8*cee313d2SEric Christopher  indirectbr i8* %addr, [ label %if.then, label %if.end]
9*cee313d2SEric Christopher
10*cee313d2SEric Christopherif.then:                                          ; preds = %entry
11*cee313d2SEric Christopher  %mul = mul nsw i32 %v, 10
12*cee313d2SEric Christopher  br label %if.then2
13*cee313d2SEric Christopher
14*cee313d2SEric Christopherif.then2:
15*cee313d2SEric Christopher  %sub = sub i32 %v, 10
16*cee313d2SEric Christopher  br label %if.end
17*cee313d2SEric Christopher
18*cee313d2SEric Christopherif.end:                                           ; preds = %if.then, %entry
19*cee313d2SEric Christopher  %v2 = phi i32 [ %v, %entry ], [ %mul, %if.then2 ]
20*cee313d2SEric Christopher  %add = add nsw i32 %v2, 200
21*cee313d2SEric Christopher  ret i32 %add
22*cee313d2SEric Christopher}
23*cee313d2SEric Christopher
24*cee313d2SEric Christopherdeclare void @use_fp(i8 *)
25*cee313d2SEric Christopherdeclare void @llvm.localescape(...)
26*cee313d2SEric Christopherdeclare i8* @llvm.frameaddress(i32)
27*cee313d2SEric Christopherdeclare i8* @llvm.localrecover(i8*, i8*, i32)
28*cee313d2SEric Christopher
29*cee313d2SEric Christopher
30*cee313d2SEric Christopher
31*cee313d2SEric Christopherdefine i32 @callee_frameescape(i32 %v) {
32*cee313d2SEric Christopherentry:
33*cee313d2SEric Christopher  %a = alloca i32
34*cee313d2SEric Christopher  call void (...) @llvm.localescape(i32* %a)
35*cee313d2SEric Christopher  %cmp = icmp sgt i32 %v, 2000
36*cee313d2SEric Christopher  br i1 %cmp, label %if.then, label %if.end
37*cee313d2SEric Christopher
38*cee313d2SEric Christopherif.then:                                          ; preds = %entry
39*cee313d2SEric Christopher  %mul = mul nsw i32 %v, 10
40*cee313d2SEric Christopher  br label %if.then2
41*cee313d2SEric Christopher
42*cee313d2SEric Christopherif.then2:
43*cee313d2SEric Christopher  %sub = sub i32 %v, 10
44*cee313d2SEric Christopher  br label %if.end
45*cee313d2SEric Christopher
46*cee313d2SEric Christopherif.end:                                           ; preds = %if.then, %entry
47*cee313d2SEric Christopher  %v2 = phi i32 [ %v, %entry ], [ %mul, %if.then2 ]
48*cee313d2SEric Christopher  %add = add nsw i32 %v2, 200
49*cee313d2SEric Christopher  ret i32 %add
50*cee313d2SEric Christopher}
51*cee313d2SEric Christopher
52*cee313d2SEric Christopher
53*cee313d2SEric Christopher; CHECK-LABEL: @caller
54*cee313d2SEric Christopher; CHECK: %r1 = call i32 @callee_indr_branch(i32 %v)
55*cee313d2SEric Christopher; CHECK-NEXT: %r2 = call i32 @callee_frameescape(i32 %v)
56*cee313d2SEric Christopherdefine i32 @caller(i32 %v) {
57*cee313d2SEric Christopherentry:
58*cee313d2SEric Christopher  %r1 = call i32 @callee_indr_branch(i32 %v)
59*cee313d2SEric Christopher  %r2 = call i32 @callee_frameescape(i32 %v)
60*cee313d2SEric Christopher  %res = add i32 %r1, %r2
61*cee313d2SEric Christopher  ret i32 %res
62*cee313d2SEric Christopher}
63*cee313d2SEric Christopher
64