1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

If there are attributes on the varargs part of a

call, don't discard them.

llvm-svn: 45884
This commit is contained in:
Duncan Sands 2008-01-11 21:23:39 +00:00
parent 5afa19350b
commit d99973b822
2 changed files with 26 additions and 2 deletions

View File

@ -2675,8 +2675,15 @@ BBTerminatorInst : RET ResolvedVal { // Return with a result...
if (Ty->isVarArg()) {
if (I == E)
for (; ArgI != ArgE; ++ArgI)
for (; ArgI != ArgE; ++ArgI, ++index) {
Args.push_back(ArgI->Val); // push the remaining varargs
if (ArgI->Attrs != ParamAttr::None) {
ParamAttrsWithIndex PAWI;
PAWI.index = index;
PAWI.attrs = ArgI->Attrs;
Attrs.push_back(PAWI);
}
}
} else if (I != E || ArgI != ArgE)
GEN_ERROR("Invalid number of parameters detected");
}
@ -3006,8 +3013,15 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
}
if (Ty->isVarArg()) {
if (I == E)
for (; ArgI != ArgE; ++ArgI)
for (; ArgI != ArgE; ++ArgI, ++index) {
Args.push_back(ArgI->Val); // push the remaining varargs
if (ArgI->Attrs != ParamAttr::None) {
ParamAttrsWithIndex PAWI;
PAWI.index = index;
PAWI.attrs = ArgI->Attrs;
Attrs.push_back(PAWI);
}
}
} else if (I != E || ArgI != ArgE)
GEN_ERROR("Invalid number of parameters detected");
}

View File

@ -0,0 +1,10 @@
; RUN: llvm-as < %s | llvm-dis | grep byval | count 2
%struct = type { }
declare void @foo(...)
define void @bar() {
call void (...)* @foo(%struct* byval null, %struct* byval null )
ret void
}