llvm/test/Verifier/deoptimize-intrinsic.ll
Sanjoy Das d2e75bd7aa All llvm.deoptimize declarations must use the same calling convention
This new verifier rule lets us unambigously pick a calling convention
when creating a new declaration for
`@llvm.experimental.deoptimize.<ty>`.  It is also congruent with our
lowering strategy -- since all calls to `@llvm.experimental.deoptimize`
are lowered to calls to `__llvm_deoptimize`, it is reasonable to enforce
a unique calling convention.

Some of the tests that were breaking this verifier rule have had to be
split up into different .ll files.

The inliner was violating this rule as well, and has been fixed to avoid
producing invalid IR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269261 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-12 01:17:38 +00:00

46 lines
1.3 KiB
LLVM

; RUN: not opt -verify < %s 2>&1 | FileCheck %s
declare i8 @llvm.experimental.deoptimize.i8(...)
declare void @llvm.experimental.deoptimize.isVoid(...)
declare cc40 void @llvm.experimental.deoptimize.double(...)
declare void @unknown()
define void @f_notail() {
entry:
call void(...) @llvm.experimental.deoptimize.isVoid(i32 0) [ "deopt"() ]
; CHECK: calls to experimental_deoptimize must be followed by a return
call void @unknown()
ret void
}
define void @f_nodeopt() {
entry:
call void(...) @llvm.experimental.deoptimize.isVoid()
; CHECK: experimental_deoptimize must have exactly one "deopt" operand bundle
ret void
}
define void @f_invoke() personality i8 3 {
entry:
invoke void(...) @llvm.experimental.deoptimize.isVoid(i32 0, float 0.0) to label %ok unwind label %not_ok
; CHECK: experimental_deoptimize cannot be invoked
ok:
ret void
not_ok:
%0 = landingpad { i8*, i32 }
filter [0 x i8*] zeroinitializer
ret void
}
define i8 @f_incorrect_return() {
entry:
%val = call i8(...) @llvm.experimental.deoptimize.i8() [ "deopt"() ]
; CHECK: calls to experimental_deoptimize must be followed by a return of the value computed by experimental_deoptimize
ret i8 0
}
; CHECK: All llvm.experimental.deoptimize declarations must have the same calling convention