forked from M-Labs/artiq
Generate more compact ARTIQ IR for else-less if.
This commit is contained in:
parent
e96bc3c36c
commit
255ffec483
|
@ -238,6 +238,7 @@ class IRGenerator(algorithm.Visitor):
|
|||
self.current_block = if_true
|
||||
self.visit(node.body)
|
||||
|
||||
if any(node.orelse):
|
||||
if_false = self.add_block()
|
||||
self.current_block = if_false
|
||||
self.visit(node.orelse)
|
||||
|
@ -246,9 +247,13 @@ class IRGenerator(algorithm.Visitor):
|
|||
self.current_block = tail
|
||||
if not if_true.is_terminated():
|
||||
if_true.append(ir.Branch(tail))
|
||||
|
||||
if any(node.orelse):
|
||||
if not if_false.is_terminated():
|
||||
if_false.append(ir.Branch(tail))
|
||||
head.append(ir.BranchIf(cond, if_true, if_false))
|
||||
else:
|
||||
head.append(ir.BranchIf(cond, if_true, tail))
|
||||
|
||||
def visit_While(self, node):
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue