From f91e1065862e38009a6430343f01c54faddaea42 Mon Sep 17 00:00:00 2001 From: Timothy Ballance Date: Tue, 22 Mar 2022 18:50:46 +0800 Subject: [PATCH] llvm_ir: fixed broken code in previous patch --- artiq/compiler/transforms/llvm_ir_generator.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/artiq/compiler/transforms/llvm_ir_generator.py b/artiq/compiler/transforms/llvm_ir_generator.py index 7bf6037f8..50ce33f61 100644 --- a/artiq/compiler/transforms/llvm_ir_generator.py +++ b/artiq/compiler/transforms/llvm_ir_generator.py @@ -1584,9 +1584,9 @@ class LLVMIRGenerator: insn.arguments(), llnormalblock, llunwindblock) 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: - llfun, llargs, llarg_attrs = self._prepare_closure_call(insn) + llfun, llargs, llarg_attrs, llcallstackptr = self._prepare_closure_call(insn) if self.has_sret(functiontyp): 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, # so unlike process_Call, we do not set it here. + if llcallstackptr != None: + self.llbuilder.call(self.llbuiltin("llvm.stackrestore"), [llcallstackptr]) + return llresult def _quote_listish_to_llglobal(self, value, elt_type, path, kind_name):