• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -S -partial-inliner -skip-partial-inlining-cost-analysis=true | FileCheck %s
2
3
4define i32 @callee_most(i32 %v) unnamed_addr  #0 #1 {
5entry:
6  %cmp = icmp sgt i32 %v, 2000
7  br i1 %cmp, label %if.then, label %if.end
8
9if.then:
10  br label %if.then2
11
12if.then2:
13  %sub = sub i32 %v, 10
14  br label %if.end
15
16if.end:
17  %v2 = phi i32 [ %v, %entry ], [ %sub, %if.then2 ]
18  %add = add nsw i32 %v2, 200
19  ret i32 %add
20}
21
22define i32 @callee_noinline(i32 %v) optnone noinline {
23entry:
24  %cmp = icmp sgt i32 %v, 2000
25  br i1 %cmp, label %if.then, label %if.end
26
27if.then:
28  br label %if.then2
29
30if.then2:
31  %sub = sub i32 %v, 10
32  br label %if.end
33
34if.end:
35  %v2 = phi i32 [ %v, %entry ], [ %sub, %if.then2 ]
36  %add = add nsw i32 %v2, 200
37  ret i32 %add
38}
39
40define i32 @callee_writeonly(i32 %v) writeonly ssp {
41entry:
42  %cmp = icmp sgt i32 %v, 2000
43  br i1 %cmp, label %if.then, label %if.end
44
45if.then:
46  br label %if.then2
47
48if.then2:
49  %sub = sub i32 %v, 10
50  br label %if.end
51
52if.end:
53  %v2 = phi i32 [ %v, %entry ], [ %sub, %if.then2 ]
54  %add = add nsw i32 %v2, 200
55  ret i32 %add
56}
57; CHECK-LABEL: @caller
58; CHECK: call void @callee_most.2.if.then(i32 %v
59; CHECK: call i32 @callee_noinline(i32 %v)
60; CHECK: call void @callee_writeonly.1.if.then(i32 %v
61define i32 @caller(i32 %v) ssp {
62entry:
63  %c1 = call i32 @callee_most(i32 %v)
64  %c2 = call i32 @callee_noinline(i32 %v)
65  %c3 = call i32 @callee_writeonly(i32 %v)
66  ret i32 %c3
67}
68
69; CHECK: define internal void @callee_writeonly.1.if.then(i32 %v, i32* %sub.out) [[FN_ATTRS0:#[0-9]+]]
70; CHECK: define internal void @callee_most.2.if.then(i32 %v, i32* %sub.out)  [[FN_ATTRS:#[0-9]+]]
71
72; attributes to preserve
73attributes #0 = {
74  inlinehint minsize noduplicate noimplicitfloat norecurse noredzone nounwind
75  nonlazybind optsize safestack sanitize_address sanitize_hwaddress sanitize_memory
76  sanitize_thread ssp sspreq sspstrong strictfp uwtable "foo"="bar"
77  "patchable-function"="prologue-short-redirect" "probe-stack"="_foo_guard" "stack-probe-size"="4096" }
78
79; CHECK: attributes [[FN_ATTRS0]] = { ssp
80; CHECK: attributes [[FN_ATTRS]] = { inlinehint minsize noduplicate noimplicitfloat norecurse noredzone nounwind nonlazybind optsize safestack sanitize_address sanitize_hwaddress sanitize_memory sanitize_thread ssp sspreq sspstrong strictfp uwtable "foo"="bar" "patchable-function"="prologue-short-redirect" "probe-stack"="_foo_guard" "stack-probe-size"="4096" }
81
82; attributes to drop
83attributes #1 = {
84  alignstack=16 convergent inaccessiblememonly inaccessiblemem_or_argmemonly naked
85  noreturn readonly argmemonly returns_twice speculatable "thunk"
86}
87