llvm_ir: fixed broken code in previous patch

This commit is contained in:
Timothy Ballance 2022-03-22 18:50:46 +08:00 committed by Sebastien Bourdeauducq
parent a289d69883
commit f91e106586
1 changed files with 5 additions and 2 deletions

View File

@ -1584,9 +1584,9 @@ class LLVMIRGenerator:
insn.arguments(), insn.arguments(),
llnormalblock, llunwindblock) llnormalblock, llunwindblock)
elif types.is_external_function(functiontyp): elif types.is_external_function(functiontyp):
llfun, llargs, llarg_attrs = self._prepare_ffi_call(insn) llfun, llargs, llarg_attrs, llcallstackptr = self._prepare_ffi_call(insn)
else: else:
llfun, llargs, llarg_attrs = self._prepare_closure_call(insn) llfun, llargs, llarg_attrs, llcallstackptr = self._prepare_closure_call(insn)
if self.has_sret(functiontyp): if self.has_sret(functiontyp):
llstackptr = self.llbuilder.call(self.llbuiltin("llvm.stacksave"), []) llstackptr = self.llbuilder.call(self.llbuiltin("llvm.stacksave"), [])
@ -1608,6 +1608,9 @@ class LLVMIRGenerator:
# The !tbaa metadata is not legal to use with the invoke instruction, # The !tbaa metadata is not legal to use with the invoke instruction,
# so unlike process_Call, we do not set it here. # so unlike process_Call, we do not set it here.
if llcallstackptr != None:
self.llbuilder.call(self.llbuiltin("llvm.stackrestore"), [llcallstackptr])
return llresult return llresult
def _quote_listish_to_llglobal(self, value, elt_type, path, kind_name): def _quote_listish_to_llglobal(self, value, elt_type, path, kind_name):