mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 20:23:11 +01:00
859ff3505c
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.
73 lines
2.2 KiB
LLVM
73 lines
2.2 KiB
LLVM
; RUN: not opt -verify %s 2>&1 | FileCheck %s
|
|
|
|
declare swifttailcc void @simple()
|
|
|
|
define swifttailcc void @inreg(i8* inreg) {
|
|
; CHECK: inreg attribute not allowed in swifttailcc musttail caller
|
|
musttail call swifttailcc void @simple()
|
|
ret void
|
|
}
|
|
|
|
define swifttailcc void @inalloca(i8* inalloca(i8)) {
|
|
; CHECK: inalloca attribute not allowed in swifttailcc musttail caller
|
|
musttail call swifttailcc void @simple()
|
|
ret void
|
|
}
|
|
|
|
define swifttailcc void @swifterror(i8** swifterror) {
|
|
; CHECK: swifterror attribute not allowed in swifttailcc musttail caller
|
|
musttail call swifttailcc void @simple()
|
|
ret void
|
|
}
|
|
|
|
define swifttailcc void @preallocated(i8* preallocated(i8)) {
|
|
; CHECK: preallocated attribute not allowed in swifttailcc musttail caller
|
|
musttail call swifttailcc void @simple()
|
|
ret void
|
|
}
|
|
|
|
define swifttailcc void @byref(i8* byref(i8)) {
|
|
; CHECK: byref attribute not allowed in swifttailcc musttail caller
|
|
musttail call swifttailcc void @simple()
|
|
ret void
|
|
}
|
|
|
|
define swifttailcc void @call_inreg() {
|
|
; CHECK: inreg attribute not allowed in swifttailcc musttail callee
|
|
musttail call swifttailcc void @inreg(i8* inreg undef)
|
|
ret void
|
|
}
|
|
|
|
define swifttailcc void @call_inalloca() {
|
|
; CHECK: inalloca attribute not allowed in swifttailcc musttail callee
|
|
musttail call swifttailcc void @inalloca(i8* inalloca(i8) undef)
|
|
ret void
|
|
}
|
|
|
|
define swifttailcc void @call_swifterror() {
|
|
; CHECK: swifterror attribute not allowed in swifttailcc musttail callee
|
|
%err = alloca swifterror i8*
|
|
musttail call swifttailcc void @swifterror(i8** swifterror %err)
|
|
ret void
|
|
}
|
|
|
|
define swifttailcc void @call_preallocated() {
|
|
; CHECK: preallocated attribute not allowed in swifttailcc musttail callee
|
|
musttail call swifttailcc void @preallocated(i8* preallocated(i8) undef)
|
|
ret void
|
|
}
|
|
|
|
define swifttailcc void @call_byref() {
|
|
; CHECK: byref attribute not allowed in swifttailcc musttail callee
|
|
musttail call swifttailcc void @byref(i8* byref(i8) undef)
|
|
ret void
|
|
}
|
|
|
|
|
|
declare swifttailcc void @varargs(...)
|
|
define swifttailcc void @call_varargs(...) {
|
|
; CHECK: cannot guarantee swifttailcc tail call for varargs function
|
|
musttail call swifttailcc void(...) @varargs(...)
|
|
ret void
|
|
}
|