llvm-mirror/test/Verifier/guard-intrinsic.ll
Sanjoy Das f200766275 Introduce a @llvm.experimental.guard intrinsic
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
2016-03-31 00:18:46 +00:00

27 lines
622 B
LLVM

; RUN: not opt -S -verify < %s 2>&1 | FileCheck %s
declare void @llvm.experimental.guard(i1, ...)
declare void @unknown()
define void @f_nodeopt() {
entry:
call void(i1, ...) @llvm.experimental.guard(i1 undef, i32 1, i32 2)
; CHECK: guard must have exactly one "deopt" operand bundle
ret void
}
define void @f_invoke() personality i8 3 {
entry:
invoke void(i1, ...) @llvm.experimental.guard(i1 undef, i32 0, float 0.0) [ "deopt"() ] to label %ok unwind label %not_ok
; CHECK: guard cannot be invoked
ok:
ret void
not_ok:
%0 = landingpad { i8*, i32 }
filter [0 x i8*] zeroinitializer
ret void
}