Skip to content

Commit

Permalink
transforms.artiq_ir_generator: fix While codegen (closes #207).
Browse files Browse the repository at this point in the history
whitequark committed Dec 26, 2015
1 parent 502e570 commit b931096
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion artiq/compiler/transforms/artiq_ir_generator.py
Original file line number Diff line number Diff line change
@@ -417,6 +417,7 @@ def visit_While(self, node):
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 @@ def visit_While(self, node):
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))

0 comments on commit b931096

Please sign in to comment.