1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test/Verifier/tailcc-musttail.ll
Tim Northover 859ff3505c SwiftTailCC: teach verifier musttail rules applicable to this CC.
SwiftTailCC has a different set of requirements than the C calling convention
for a tail call. The exact argument sequence doesn't have to match, but fewer
ABI-affecting attributes are allowed.

Also make sure the musttail diagnostic triggers if a musttail call isn't
actually a tail call.
2021-05-28 11:12:00 +01:00

73 lines
2.0 KiB
LLVM

; RUN: not opt -verify %s 2>&1 | FileCheck %s
declare tailcc void @simple()
define tailcc void @inreg(i8* inreg) {
; CHECK: inreg attribute not allowed in tailcc musttail caller
musttail call tailcc void @simple()
ret void
}
define tailcc void @inalloca(i8* inalloca(i8)) {
; CHECK: inalloca attribute not allowed in tailcc musttail caller
musttail call tailcc void @simple()
ret void
}
define tailcc void @swifterror(i8** swifterror) {
; CHECK: swifterror attribute not allowed in tailcc musttail caller
musttail call tailcc void @simple()
ret void
}
define tailcc void @preallocated(i8* preallocated(i8)) {
; CHECK: preallocated attribute not allowed in tailcc musttail caller
musttail call tailcc void @simple()
ret void
}
define tailcc void @byref(i8* byref(i8)) {
; CHECK: byref attribute not allowed in tailcc musttail caller
musttail call tailcc void @simple()
ret void
}
define tailcc void @call_inreg() {
; CHECK: inreg attribute not allowed in tailcc musttail callee
musttail call tailcc void @inreg(i8* inreg undef)
ret void
}
define tailcc void @call_inalloca() {
; CHECK: inalloca attribute not allowed in tailcc musttail callee
musttail call tailcc void @inalloca(i8* inalloca(i8) undef)
ret void
}
define tailcc void @call_swifterror() {
; CHECK: swifterror attribute not allowed in tailcc musttail callee
%err = alloca swifterror i8*
musttail call tailcc void @swifterror(i8** swifterror %err)
ret void
}
define tailcc void @call_preallocated() {
; CHECK: preallocated attribute not allowed in tailcc musttail callee
musttail call tailcc void @preallocated(i8* preallocated(i8) undef)
ret void
}
define tailcc void @call_byref() {
; CHECK: byref attribute not allowed in tailcc musttail callee
musttail call tailcc void @byref(i8* byref(i8) undef)
ret void
}
declare tailcc void @varargs(...)
define tailcc void @call_varargs(...) {
; CHECK: cannot guarantee tailcc tail call for varargs function
musttail call tailcc void(...) @varargs(...)
ret void
}