mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
f200766275
Summary: As discussed on llvm-dev[1]. This change adds the basic boilerplate code around having this intrinsic in LLVM: - Changes in Intrinsics.td, and the IR Verifier - A lowering pass to lower @llvm.experimental.guard to normal control flow - Inliner support [1]: http://lists.llvm.org/pipermail/llvm-dev/2016-February/095523.html Reviewers: reames, atrick, chandlerc, rnk, JosephTremoulet, echristo Subscribers: mcrosier, llvm-commits Differential Revision: http://reviews.llvm.org/D18527 llvm-svn: 264976
40 lines
1.1 KiB
LLVM
40 lines
1.1 KiB
LLVM
; 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
|
|
}
|