Skip to content

Commit 607a77e

Browse files
authored
feat: MakeTuple->UnpackTuple elision pass (#2012)
Imports the `MakeTuple -> UnpackTuple` elimination pass from tket2. This removes tuple unpacks consuming the output of a `MakeTuple`, and deletes the packing operation when possible. This pass *does not* remove the reverse case, `Unpack->MakeTuple`. Should it be added here? We should avoid producing overlapping rewrites if doing that (the simple `Pack->Unpack->Pack` case is easy, but multiports can make things interesting). Requires #2011 Closes #1810
1 parent 4ff511f commit 607a77e

File tree

4 files changed

+433
-0
lines changed

4 files changed

+433
-0
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hugr-passes/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ bench = false
1919
hugr-core = { path = "../hugr-core", version = "0.15.2" }
2020
portgraph = { workspace = true }
2121
ascent = { version = "0.8.0" }
22+
derive_more = { workspace = true, features = ["display", "error", "from"] }
2223
itertools = { workspace = true }
2324
lazy_static = { workspace = true }
2425
paste = { workspace = true }

hugr-passes/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ mod half_node;
1212
pub mod lower;
1313
pub mod merge_bbs;
1414
mod monomorphize;
15+
pub mod untuple;
1516

1617
// TODO: Deprecated re-export. Remove on a breaking release.
1718
#[deprecated(
@@ -36,3 +37,4 @@ pub mod validation;
3637
pub use force_order::{force_order, force_order_by_key};
3738
pub use lower::{lower_ops, replace_many_ops};
3839
pub use non_local::{ensure_no_nonlocal_edges, nonlocal_edges};
40+
pub use untuple::UntuplePass;

0 commit comments

Comments
 (0)