llvm-6502/test/Verifier/musttail-valid.ll
Reid Kleckner dae28732f4 Verifier: Don't reject varargs callee cleanup functions
We've rejected these kinds of functions since r28405 in 2006 because
it's impossible to lower the return of a callee cleanup varargs
function. However there are lots of legal ways to leave such a function
without returning, such as aborting. Today we can leave a function with
a musttail call to another function with the correct prototype, and
everything works out.

I'm removing the verifier check declaring that a normal return from such
a function is UB.

Reviewed By: nlewycky

Differential Revision: http://reviews.llvm.org/D5059

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216779 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-29 21:25:28 +00:00

40 lines
1.1 KiB
LLVM

; RUN: llvm-as %s -o /dev/null
; Should assemble without error.
declare void @similar_param_ptrty_callee(i8*)
define void @similar_param_ptrty(i32*) {
musttail call void @similar_param_ptrty_callee(i8* null)
ret void
}
declare i8* @similar_ret_ptrty_callee()
define i32* @similar_ret_ptrty() {
%v = musttail call i8* @similar_ret_ptrty_callee()
%w = bitcast i8* %v to i32*
ret i32* %w
}
declare x86_thiscallcc void @varargs_thiscall(i8*, ...)
define x86_thiscallcc void @varargs_thiscall_thunk(i8* %this, ...) {
musttail call x86_thiscallcc void (i8*, ...)* @varargs_thiscall(i8* %this, ...)
ret void
}
declare x86_fastcallcc void @varargs_fastcall(i8*, ...)
define x86_fastcallcc void @varargs_fastcall_thunk(i8* %this, ...) {
musttail call x86_fastcallcc void (i8*, ...)* @varargs_fastcall(i8* %this, ...)
ret void
}
define x86_thiscallcc void @varargs_thiscall_unreachable(i8* %this, ...) {
unreachable
}
define x86_thiscallcc void @varargs_thiscall_ret_unreachable(i8* %this, ...) {
musttail call x86_thiscallcc void (i8*, ...)* @varargs_thiscall(i8* %this, ...)
ret void
bb1:
ret void
}