blob: 4aa0c28bfc722d5b4c21681bb593888831becb35 [file] [log] [blame]
Philip Reames9b5c9582015-06-26 20:51:17 +00001; RUN: opt -S -inline %s | FileCheck %s
2
3declare void @foo()
4declare void @bar()
5
6define void @callee(i8* %arg) {
7 %cmp = icmp eq i8* %arg, null
8 br i1 %cmp, label %expensive, label %done
9
10; This block is designed to be too expensive to inline. We can only inline
11; callee if this block is known to be dead.
12expensive:
13 call void @foo()
14 call void @foo()
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 ret void
24
25done:
26 call void @bar()
27 ret void
28}
29
30; Positive test - arg is known non null
31define void @caller(i8* nonnull %arg) {
32; CHECK-LABEL: @caller
33; CHECK: call void @bar()
34 call void @callee(i8* nonnull %arg)
35 ret void
36}
37
38; Negative test - arg is not known to be non null
39define void @caller2(i8* %arg) {
40; CHECK-LABEL: @caller2
41; CHECK: call void @callee(
42 call void @callee(i8* %arg)
43 ret void
44}
45