LLVM: only add sret attribute for first parameter on caller side

We already did this when generating the definitions, but not yet
when generating the calls
This commit is contained in:
Jonas Maebe 2023-07-30 20:19:43 +02:00
parent b49d58a9fa
commit 2949d0b548

View File

@ -163,7 +163,12 @@ unit llvmpara;
paralocs }
while assigned(paraloc) do
begin
if (vo_is_funcret in parasym.varoptions)
if (vo_is_funcret in parasym.varoptions) and
{ sret attribute is only valid for the first parameter; sometimes
FPC will place other parameters first (e.g. self), and then
we can't use it; we use other attributes in that case to
approximate the optimisations that LLVM can do for sret }
(tabstractprocdef(parasym.owner.defowner).paras[0] = parasym)
{$ifdef aarch64}
{ see AArch64's tcpuparamanager.create_paraloc_info_intern() }
and not is_managed_type(parasym.vardef)