-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge basic blocks #561
Comments
@acl-cqc We discussed this morning where this sort of thing (also #818 ) should go, and the general agreement that there should be a "hugr-passes" crate, in the hugr repo, where passes that operate on general HUGRs go. (Other quantum-specific passes would go in the TKET2 repo.) This makes for a cleaner separation between passes (which shouldn't rely on hugr internals) and core hugr. Does this seem reasonable? |
Any basic block with a single successor that has no other predecessors can be merged. (So long as the successor is not the exit block; nor the entry block, as that implicitly has another predecessor). Implement via Replace (2 BBs - > one BB containing 2 DFGs, which adopt the original BB's children) and 2*InlineDFG. Closes #561.
i.e. when there is an edge from a BB with only one successor, to a BB with only one predecessor, the two can be combined. As a first step this would produce one BB containing two DFG nodes one of which consumes all outputs of the other, but then 2*InlineDFG operations to flatten them should remove false dependencies and enable additional optimizations.
Might require implementing both Replacement and/or InlineDFG rewrites...
The text was updated successfully, but these errors were encountered: