Skip to content
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

Closed
acl-cqc opened this issue Sep 27, 2023 · 1 comment · Fixed by #956
Closed

Merge basic blocks #561

acl-cqc opened this issue Sep 27, 2023 · 1 comment · Fixed by #956
Assignees

Comments

@acl-cqc
Copy link
Contributor

acl-cqc commented Sep 27, 2023

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...

@acl-cqc acl-cqc self-assigned this Jan 24, 2024
@cqc-alec
Copy link
Collaborator

cqc-alec commented May 1, 2024

@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?

github-merge-queue bot pushed a commit that referenced this issue May 10, 2024
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants