Skip to content

Commit

Permalink
fix: Don't reorder inputs of entry BB (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-koch authored Jun 13, 2024
1 parent c0e2140 commit ad56b99
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions guppylang/compiler/cfg_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ def compile_cfg(

blocks: dict[CheckedBB, CFNode] = {}
for bb in cfg.bbs:
blocks[bb] = compile_bb(bb, graph, parent, globals)
blocks[bb] = compile_bb(bb, graph, parent, bb == cfg.entry_bb, globals)
for bb in cfg.bbs:
for succ in bb.successors:
graph.add_edge(blocks[bb].add_out_port(), blocks[succ].in_port(None))


def compile_bb(
bb: CheckedBB, graph: Hugr, parent: Node, globals: CompiledGlobals
bb: CheckedBB, graph: Hugr, parent: Node, is_entry: bool, globals: CompiledGlobals
) -> CFNode:
"""Compiles a single basic block to Hugr."""
inputs = sort_vars(bb.sig.input_row)
inputs = bb.sig.input_row if is_entry else sort_vars(bb.sig.input_row)

# The exit BB is completely empty
if len(bb.successors) == 0:
Expand Down

0 comments on commit ad56b99

Please sign in to comment.