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

[Relax] Identify tuple unpack/repack in CanonicalizeBindings #17313

Conversation

Lunderberg
Copy link
Contributor

Prior to this commit, the CanonicalizeBindings pass could identify and simplify a value that had been packed into a tuple, then extracted from it. (e.g. Simplifying tup = (x,y); z = tup[0] into z = x.) However, it could not identify a value that had been expanded from a tuple, and then re-bundled. (e.g. Simplifying new_tuple = (tup[0], tup[1]) into new_tuple = tup.)

This commit updates CanonicalizeBindings to identify and remove unnecessary tuple unpacking/repacking.

Prior to this commit, the `CanonicalizeBindings` pass could identify
and simplify a value that had been packed into a tuple, then
extracted from it.  (e.g. Simplifying `tup = (x,y); z = tup[0]` into
`z = x`.)  However, it could not identify a value that had been
expanded from a tuple, and then re-bundled.  (e.g. Simplifying
`new_tuple = (tup[0], tup[1])` into `new_tuple = tup`.)

This commit updates `CanonicalizeBindings` to identify and remove
unnecessary tuple unpacking/repacking.
@vinx13 vinx13 merged commit 108a4e1 into apache:main Aug 28, 2024
18 of 19 checks passed
@Lunderberg Lunderberg deleted the relax_remove_tuple_round_trip_in_canonicalize_bindings branch August 29, 2024 14:02
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 this pull request may close these issues.

2 participants