guard-intrinsic.ll
1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
; RUN: opt -S -always-inline < %s | FileCheck %s
declare void @llvm.experimental.guard(i1, ...)
define i8 @callee(i1* %c_ptr) alwaysinline {
%c = load volatile i1, i1* %c_ptr
call void(i1, ...) @llvm.experimental.guard(i1 %c, i32 1) [ "deopt"(i32 1) ]
ret i8 5
}
define void @caller_0(i1* %c, i8* %ptr) {
; CHECK-LABEL: @caller_0(
entry:
; CHECK: [[COND:%[^ ]+]] = load volatile i1, i1* %c
; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[COND]], i32 1) [ "deopt"(i32 2, i32 1) ]
; CHECK-NEXT: store i8 5, i8* %ptr
%v = call i8 @callee(i1* %c) [ "deopt"(i32 2) ]
store i8 %v, i8* %ptr
ret void
}
define i32 @caller_1(i1* %c, i8* %ptr) personality i8 3 {
; CHECK-LABEL: @caller_1(
; CHECK: [[COND:%[^ ]+]] = load volatile i1, i1* %c
; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[COND]], i32 1) [ "deopt"(i32 3, i32 1) ]
; CHECK-NEXT: br label %normal
entry:
%v = invoke i8 @callee(i1* %c) [ "deopt"(i32 3) ] to label %normal
unwind label %unwind
unwind:
%lp = landingpad i32 cleanup
ret i32 43
normal:
store i8 %v, i8* %ptr
ret i32 42
}