From b931096ec39d35e8257a9e281c5f8effbb965b06 Mon Sep 17 00:00:00 2001 From: whitequark Date: Sat, 26 Dec 2015 17:24:05 +0800 Subject: [PATCH] transforms.artiq_ir_generator: fix While codegen (closes #207). --- artiq/compiler/transforms/artiq_ir_generator.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/artiq/compiler/transforms/artiq_ir_generator.py b/artiq/compiler/transforms/artiq_ir_generator.py index a76fd76a9..e0eda3929 100644 --- a/artiq/compiler/transforms/artiq_ir_generator.py +++ b/artiq/compiler/transforms/artiq_ir_generator.py @@ -417,6 +417,7 @@ class ARTIQIRGenerator(algorithm.Visitor): self.current_block = head old_continue, self.continue_target = self.continue_target, head cond = self.visit(node.test) + post_head = self.current_block break_block = self.add_block("while.break") old_break, self.break_target = self.break_target, break_block @@ -441,7 +442,7 @@ class ARTIQIRGenerator(algorithm.Visitor): else: else_tail = tail - head.append(ir.BranchIf(cond, body, else_tail)) + post_head.append(ir.BranchIf(cond, body, else_tail)) if not post_body.is_terminated(): post_body.append(ir.Branch(head)) break_block.append(ir.Branch(tail))