1 ; RUN: opt -S -always-inline < %s | FileCheck %s
5 declare fastcc i32 @g.fastcc()
7 define i32 @callee_0() alwaysinline {
13 define i32 @caller_0() {
14 ; CHECK-LABEL: @caller_0(
17 ; CHECK-NEXT: call void @f()
18 ; CHECK-NEXT: ret i32 2
19 %x = call i32 @callee_0() [ "deopt"(i32 5) ]
23 define i32 @callee_1() alwaysinline {
25 call void @f() [ "deopt"() ]
26 call void @f() [ "deopt"(i32 0, i32 1) ]
27 call void @f() [ "deopt"(i32 0, i32 1), "foo"(double 0.0) ]
31 define i32 @caller_1() {
32 ; CHECK-LABEL: @caller_1(
35 ; CHECK-NEXT: call void @f() [ "deopt"(i32 5) ]
36 ; CHECK-NEXT: call void @f() [ "deopt"(i32 5, i32 0, i32 1) ]
37 ; CHECK-NEXT: call void @f() [ "deopt"(i32 5, i32 0, i32 1), "foo"(double 0.000000e+00) ]
38 ; CHECK-NEXT: ret i32 2
40 %x = call i32 @callee_1() [ "deopt"(i32 5) ]
44 define i32 @callee_2() alwaysinline {
46 %v = call i32 @g() [ "deopt"(i32 0, i32 1), "foo"(double 0.0) ]
50 define i32 @caller_2(i32 %val) {
51 ; CHECK-LABEL: @caller_2(
54 ; CHECK-NEXT: [[RVAL:%[^ ]+]] = call i32 @g() [ "deopt"(i32 %val, i32 0, i32 1), "foo"(double 0.000000e+00) ]
55 ; CHECK-NEXT: ret i32 [[RVAL]]
56 %x = call i32 @callee_2() [ "deopt"(i32 %val) ]
60 define i32 @callee_3() alwaysinline {
62 %v = call i32 @g() [ "deopt"(i32 0, i32 1), "foo"(double 0.0) ]
66 define i32 @caller_3() personality i8 3 {
67 ; CHECK-LABEL: @caller_3(
69 %x = invoke i32 @callee_3() [ "deopt"(i32 7) ] to label %normal unwind label %unwind
70 ; CHECK: invoke i32 @g() [ "deopt"(i32 7, i32 0, i32 1), "foo"(double 0.000000e+00) ]
76 %cleanup = landingpad i8 cleanup
80 define i32 @callee_4() alwaysinline personality i8 3 {
82 %v = invoke i32 @g() [ "deopt"(i32 0, i32 1), "foo"(double 0.0) ] to label %normal unwind label %unwind
88 %cleanup = landingpad i8 cleanup
92 define i32 @caller_4() {
93 ; CHECK-LABEL: @caller_4(
95 ; CHECK: invoke i32 @g() [ "deopt"(i32 7, i32 0, i32 1), "foo"(double 0.000000e+00) ]
96 %x = call i32 @callee_4() [ "deopt"(i32 7) ]
100 define i32 @callee_5() alwaysinline personality i8 3 {
102 %v = invoke fastcc i32 @g.fastcc() #0 [ "deopt"(i32 0, i32 1), "foo"(double 0.0) ] to label %normal unwind label %unwind
108 %cleanup = landingpad i8 cleanup
112 define i32 @caller_5() {
113 ; CHECK-LABEL: @caller_5(
115 ; CHECK: invoke fastcc i32 @g.fastcc() #[[FOO_BAR_ATTR_IDX:[0-9]+]] [ "deopt"(i32 7, i32 0, i32 1), "foo"(double 0.000000e+00) ]
116 %x = call i32 @callee_5() [ "deopt"(i32 7) ]
120 define i32 @callee_6() alwaysinline personality i8 3 {
122 %v = call fastcc i32 @g.fastcc() #0 [ "deopt"(i32 0, i32 1), "foo"(double 0.0) ]
126 define i32 @caller_6() {
127 ; CHECK-LABEL: @caller_6(
129 ; CHECK: call fastcc i32 @g.fastcc() #[[FOO_BAR_ATTR_IDX]] [ "deopt"(i32 7, i32 0, i32 1), "foo"(double 0.000000e+00) ]
130 %x = call i32 @callee_6() [ "deopt"(i32 7) ]
134 define i32 @callee_7(i1 %val) alwaysinline personality i8 3 {
135 ; We want something that PruningFunctionCloner is not smart enough to
136 ; recognize, but can be recognized by recursivelySimplifyInstruction.
139 br i1 %val, label %check, label %precheck
145 %p = phi i1 [ %val, %entry ], [ true, %precheck ]
146 br i1 %p, label %do.not, label %do
152 %v = call fastcc i32 @g.fastcc() [ "deopt"(i32 0, i32 1), "foo"(double 0.0) ]
156 define i32 @caller_7() {
157 ; CHECK-LABEL: @caller_7(
159 ; CHECK-NOT: call fastcc i32 @g.fastcc()
161 %x = call i32 @callee_7(i1 true) [ "deopt"(i32 7) ]
165 define i32 @callee_8(i1 %val) alwaysinline personality i8 3 {
166 ; We want something that PruningFunctionCloner is not smart enough to
167 ; recognize, but can be recognized by recursivelySimplifyInstruction.
170 br i1 %val, label %check, label %precheck
176 %p = phi i1 [ %val, %entry ], [ true, %precheck ]
177 br i1 %p, label %do.not, label %do
183 %phi = phi i32 [ 0, %check ], [ %v, %do ]
184 %v = call fastcc i32 @g.fastcc() [ "deopt"(i32 0, i32 1), "foo"(double 0.0) ]
185 %ic = icmp eq i32 %v, 42
186 br i1 %ic, label %do, label %done
192 define i32 @caller_8() {
193 ; CHECK-LABEL: @caller_8(
195 ; CHECK-NOT: call fastcc i32 @g.fastcc()
197 %x = call i32 @callee_8(i1 true) [ "deopt"(i32 7) ]
201 attributes #0 = { "foo"="bar" }
203 ; CHECK: attributes #[[FOO_BAR_ATTR_IDX]] = { "foo"="bar" }