compiler: Emit sret call site argument attributes

LLVM 6 seemed not to mind the mismatch, but more recent
versions produce miscompilations without this.

Needs llvmlite support (GitHub: numba/llvmlite#702).
This commit is contained in:
David Nadlinger 2021-11-06 22:34:32 +00:00
parent 6a433b2fce
commit 9b01db3d11
1 changed files with 3 additions and 2 deletions

View File

@ -1355,7 +1355,7 @@ class LLVMIRGenerator:
llstackptr = self.llbuilder.call(self.llbuiltin("llvm.stacksave"), [])
llresultslot = self.llbuilder.alloca(llfun.type.pointee.args[0].pointee)
llcall = self.llbuilder.call(llfun, [llresultslot] + llargs)
self.llbuilder.call(llfun, [llresultslot] + llargs, arg_attrs={0: "sret"})
llresult = self.llbuilder.load(llresultslot)
self.llbuilder.call(self.llbuiltin("llvm.stackrestore"), [llstackptr])
@ -1388,7 +1388,8 @@ class LLVMIRGenerator:
llresultslot = self.llbuilder.alloca(llfun.type.pointee.args[0].pointee)
llcall = self.llbuilder.invoke(llfun, [llresultslot] + llargs,
llnormalblock, llunwindblock, name=insn.name)
llnormalblock, llunwindblock, name=insn.name,
arg_attrs={0: "sret"})
self.llbuilder.position_at_start(llnormalblock)
llresult = self.llbuilder.load(llresultslot)