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