1 ; RUN: opt -S -always-inline < %s | FileCheck %s
3 declare i8 @llvm.experimental.deoptimize.i8(...)
4 declare i32 @llvm.experimental.deoptimize.i32(...)
6 define i8 @callee(i1* %c) alwaysinline {
7 %c0 = load volatile i1, i1* %c
8 br i1 %c0, label %left, label %right
11 %c1 = load volatile i1, i1* %c
12 br i1 %c1, label %lleft, label %lright
15 %v0 = call i8(...) @llvm.experimental.deoptimize.i8(i32 1) [ "deopt"(i32 1) ]
22 %c2 = load volatile i1, i1* %c
23 br i1 %c2, label %rleft, label %rright
26 %v1 = call i8(...) @llvm.experimental.deoptimize.i8(i32 1, i32 300, float 500.0, <2 x i32*> undef) [ "deopt"(i32 1) ]
30 %v2 = call i8(...) @llvm.experimental.deoptimize.i8() [ "deopt"(i32 1) ]
34 define void @caller_0(i1* %c, i8* %ptr) {
35 ; CHECK-LABEL: @caller_0(
37 %v = call i8 @callee(i1* %c) [ "deopt"(i32 2) ]
42 ; CHECK-NEXT: call void (...) @llvm.experimental.deoptimize.isVoid(i32 1) [ "deopt"(i32 2, i32 1) ]
43 ; CHECK-NEXT: ret void
46 ; CHECK-NEXT: call void (...) @llvm.experimental.deoptimize.isVoid(i32 1, i32 300, float 5.000000e+02, <2 x i32*> undef) [ "deopt"(i32 2, i32 1) ]
47 ; CHECK-NEXT: ret void
50 ; CHECK-NEXT: call void (...) @llvm.experimental.deoptimize.isVoid() [ "deopt"(i32 2, i32 1) ]
51 ; CHECK-NEXT: ret void
54 ; CHECK-NEXT: store i8 10, i8* %ptr
55 ; CHECK-NEXT: ret void
59 define i32 @caller_1(i1* %c, i8* %ptr) personality i8 3 {
60 ; CHECK-LABEL: @caller_1(
62 %v = invoke i8 @callee(i1* %c) [ "deopt"(i32 3) ] to label %normal
66 ; CHECK-NEXT: %0 = call i32 (...) @llvm.experimental.deoptimize.i32(i32 1) [ "deopt"(i32 3, i32 1) ]
67 ; CHECK-NEXT: ret i32 %0
70 ; CHECK-NEXT: %1 = call i32 (...) @llvm.experimental.deoptimize.i32(i32 1, i32 300, float 5.000000e+02, <2 x i32*> undef) [ "deopt"(i32 3, i32 1) ]
71 ; CHECK-NEXT: ret i32 %1
74 ; CHECK-NEXT: %2 = call i32 (...) @llvm.experimental.deoptimize.i32() [ "deopt"(i32 3, i32 1) ]
75 ; CHECK-NEXT: ret i32 %2
78 ; CHECK-NEXT: br label %normal
81 ; CHECK-NEXT: store i8 10, i8* %ptr
82 ; CHECK-NEXT: ret i32 42
85 %lp = landingpad i32 cleanup
93 define i8 @callee_with_alloca() alwaysinline {
95 %v0 = call i8(...) @llvm.experimental.deoptimize.i8(i32 1) [ "deopt"(i8* %t) ]
99 define void @caller_with_lifetime() {
100 ; CHECK-LABEL: @caller_with_lifetime(
101 ; CHECK: call void (...) @llvm.experimental.deoptimize.isVoid(i32 1) [ "deopt"(i8* %t.i) ]
102 ; CHECK-NEXT: ret void
105 call i8 @callee_with_alloca();
109 define i8 @callee_with_dynamic_alloca(i32 %n) alwaysinline {
110 %p = alloca i8, i32 %n
111 %v = call i8(...) @llvm.experimental.deoptimize.i8(i32 1) [ "deopt"(i8* %p) ]
115 define void @caller_with_stacksaverestore(i32 %n) {
116 ; CHECK-LABEL: void @caller_with_stacksaverestore(
117 ; CHECK: call void (...) @llvm.experimental.deoptimize.isVoid(i32 1) [ "deopt"(i8* %p.i) ]
118 ; CHECK-NEXT: ret void
120 %p = alloca i32, i32 %n
121 call i8 @callee_with_dynamic_alloca(i32 %n)