forked from OSchip/llvm-project
[Verifier] Check byval/etc type when comparing ABI attributes
For musttail calls, ABI attributes between the function and the musttail call must match. The current check discards the type of type attributes like byval, which means that it will consider byval(i32) and byval(i64) (or similar) as compatible. I assume this is a leftover from before these attributes had a type argument. Ran into this while trying to tighten an assertion in AttrBuilder. Differential Revision: https://reviews.llvm.org/D105841
This commit is contained in:
parent
c68f247275
commit
1f8d3fd42b
|
@ -3323,8 +3323,9 @@ static AttrBuilder getParameterABIAttributes(int I, AttributeList Attrs) {
|
|||
Attribute::ByRef};
|
||||
AttrBuilder Copy;
|
||||
for (auto AK : ABIAttrs) {
|
||||
if (Attrs.hasParamAttribute(I, AK))
|
||||
Copy.addAttribute(AK);
|
||||
Attribute Attr = Attrs.getParamAttributes(I).getAttribute(AK);
|
||||
if (Attr.isValid())
|
||||
Copy.addAttribute(Attr);
|
||||
}
|
||||
|
||||
// `align` is ABI-affecting only in combination with `byval` or `byref`.
|
||||
|
|
|
@ -46,6 +46,13 @@ define void @mismatched_byval({ i32 }* byval({ i32 }) %a) {
|
|||
ret void
|
||||
}
|
||||
|
||||
declare void @mismatched_byval_callee2(ptr byval(i32))
|
||||
define void @mismatched_byval2(ptr byval(i64) %a) {
|
||||
; CHECK: mismatched ABI impacting function attributes
|
||||
musttail call void @mismatched_byval_callee2(ptr byval(i32) %a)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @mismatched_inreg_callee(i32 inreg)
|
||||
define void @mismatched_inreg(i32 %a) {
|
||||
; CHECK: mismatched ABI impacting function attributes
|
||||
|
|
Loading…
Reference in New Issue