1; RUN: opt -S -inline %s | FileCheck %s
2; RUN: opt -S -passes='cgscc(inline)' %s | FileCheck %s
3; RUN: opt -S -passes='module-inline' %s | FileCheck %s
4
5declare void @foo()
6declare void @bar()
7
8define void @callee(i8* %arg) {
9  %cmp = icmp eq i8* %arg, null
10  br i1 %cmp, label %expensive, label %done
11
12; This block is designed to be too expensive to inline.  We can only inline
13; callee if this block is known to be dead.
14expensive:
15  call void @foo()
16  call void @foo()
17  call void @foo()
18  call void @foo()
19  call void @foo()
20  call void @foo()
21  call void @foo()
22  call void @foo()
23  call void @foo()
24  call void @foo()
25  ret void
26
27done:
28  call void @bar()
29  ret void
30}
31
32; Positive test - arg is known non null
33define void @caller(i8* nonnull %arg) {
34; CHECK-LABEL: @caller
35; CHECK: call void @bar()
36  call void @callee(i8* nonnull %arg)
37  ret void
38}
39
40; Negative test - arg is not known to be non null
41define void @caller2(i8* %arg) {
42; CHECK-LABEL: @caller2
43; CHECK: call void @callee(
44  call void @callee(i8* %arg)
45  ret void
46}
47
48