[core] codegen: Fix use of invoke when cleanup is also present
All checks were successful
Hydra nac3artiq-msys2 Hydra build #200243 of artiq:nac3:nac3artiq-msys2
Hydra nac3artiq-msys2-pkg Hydra build #200244 of artiq:nac3:nac3artiq-msys2-pkg
Hydra nac3artiq-profile Hydra build #200245 of artiq:nac3:nac3artiq-profile
Hydra nac3artiq Hydra build #200242 of artiq:nac3:nac3artiq

This commit was merged in pull request #771.
This commit is contained in:
2026-05-05 16:16:19 +08:00
committed by sb10q
parent ef4dde0886
commit fdb4164c21
2 changed files with 34 additions and 5 deletions

View File

@@ -0,0 +1,27 @@
from min_artiq import *
from numpy import int32, int64
@extern
def get_tuple() -> tuple[int64, int32, bool]:
raise NotImplementedError("syscall not simulated")
@compile
class SretInvokeRepro:
core: KernelInvariant[Core]
def __init__(self):
self.core = Core()
@kernel
def call_sret(self):
(a, b, c) = get_tuple()
@kernel
def run(self):
self.call_sret()
if __name__ == "__main__":
SretInvokeRepro().run()

View File

@@ -446,17 +446,19 @@ impl<'ctx> CodeGenContext<'ctx, '_> {
self.builder.get_insert_block().and_then(BasicBlock::get_parent).unwrap();
let then_block =
self.ctx.append_basic_block(current, &format!("after.{call_name}"));
let result = self.fn_store.do_call(
self.fn_store.do_call(
fun,
self.builder,
args,
|value, args| {
Ok(self.builder.build_invoke(value, args, then_block, target, call_name)?)
let invoke = self.builder.build_invoke(
value, args, then_block, target, call_name,
)?;
self.builder.position_at_end(then_block);
Ok(invoke)
},
allocate,
);
self.builder.position_at_end(then_block);
result
)
},
)
}