Currently, opaque pointers are supported in two forms: The -force-opaque-pointers mode, where all pointers are opaque and typed pointers do not exist. And as a simple ptr type that can coexist with typed pointers. This patch removes support for the mixed mode. You either get typed pointers, or you get opaque pointers, but not both. In the (current) default mode, using ptr is forbidden. In -opaque-pointers mode, all pointers are opaque. The motivation here is that the mixed mode introduces additional issues that don't exist in fully opaque mode. D105155 is an example of a design problem. Looking at D109259, it would probably need additional work to support mixed mode (e.g. to generate GEPs for typed base but opaque result). Mixed mode will also end up inserting many casts between i8* and ptr, which would require significant additional work to consistently avoid. I don't think the mixed mode is particularly valuable, as it doesn't align with our end goal. The only thing I've found it to be moderately useful for is adding some opaque pointer tests in between typed pointer tests, but I think we can live without that. Differential Revision: https://reviews.llvm.org/D109290
84 lines
2.4 KiB
LLVM
84 lines
2.4 KiB
LLVM
; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
|
|
; RUN: not llvm-as %s -opaque-pointers -o /dev/null 2>&1 | FileCheck %s
|
|
|
|
; Each musttail call should fail to validate.
|
|
|
|
declare x86_stdcallcc void @cc_mismatch_callee()
|
|
define void @cc_mismatch() {
|
|
; CHECK: mismatched calling conv
|
|
musttail call x86_stdcallcc void @cc_mismatch_callee()
|
|
ret void
|
|
}
|
|
|
|
declare void @more_parms_callee(i32)
|
|
define void @more_parms() {
|
|
; CHECK: mismatched parameter counts
|
|
musttail call void @more_parms_callee(i32 0)
|
|
ret void
|
|
}
|
|
|
|
declare void @mismatched_intty_callee(i8)
|
|
define void @mismatched_intty(i32) {
|
|
; CHECK: mismatched parameter types
|
|
musttail call void @mismatched_intty_callee(i8 0)
|
|
ret void
|
|
}
|
|
|
|
declare void @mismatched_vararg_callee(i8*, ...)
|
|
define void @mismatched_vararg(i8*) {
|
|
; CHECK: mismatched varargs
|
|
musttail call void (i8*, ...) @mismatched_vararg_callee(i8* null)
|
|
ret void
|
|
}
|
|
|
|
; We would make this an implicit sret parameter, which would disturb the
|
|
; tail call.
|
|
declare { i32, i32, i32 } @mismatched_retty_callee(i32)
|
|
define void @mismatched_retty(i32) {
|
|
; CHECK: mismatched return types
|
|
musttail call { i32, i32, i32 } @mismatched_retty_callee(i32 0)
|
|
ret void
|
|
}
|
|
|
|
declare void @mismatched_byval_callee({ i32 }*)
|
|
define void @mismatched_byval({ i32 }* byval({ i32 }) %a) {
|
|
; CHECK: mismatched ABI impacting function attributes
|
|
musttail call void @mismatched_byval_callee({ i32 }* %a)
|
|
ret void
|
|
}
|
|
|
|
declare void @mismatched_inreg_callee(i32 inreg)
|
|
define void @mismatched_inreg(i32 %a) {
|
|
; CHECK: mismatched ABI impacting function attributes
|
|
musttail call void @mismatched_inreg_callee(i32 inreg %a)
|
|
ret void
|
|
}
|
|
|
|
declare void @mismatched_sret_callee(i32* sret(i32))
|
|
define void @mismatched_sret(i32* %a) {
|
|
; CHECK: mismatched ABI impacting function attributes
|
|
musttail call void @mismatched_sret_callee(i32* sret(i32) %a)
|
|
ret void
|
|
}
|
|
|
|
declare void @mismatched_alignment_callee(i32* byval(i32) align 8)
|
|
define void @mismatched_alignment(i32* byval(i32) align 4 %a) {
|
|
; CHECK: mismatched ABI impacting function attributes
|
|
musttail call void @mismatched_alignment_callee(i32* byval(i32) align 8 %a)
|
|
ret void
|
|
}
|
|
|
|
declare i32 @not_tail_pos_callee()
|
|
define i32 @not_tail_pos() {
|
|
; CHECK: musttail call must precede a ret with an optional bitcast
|
|
%v = musttail call i32 @not_tail_pos_callee()
|
|
%w = add i32 %v, 1
|
|
ret i32 %w
|
|
}
|
|
|
|
define void @inline_asm() {
|
|
; CHECK: cannot use musttail call with inline asm
|
|
musttail call void asm "ret", ""()
|
|
ret void
|
|
}
|