Skip to content

[Unity] Unwrap tuples during CanonicalizeBindings#15696

Merged
slyubomirsky merged 1 commit intoapache:unityfrom
Lunderberg:unity_canonicalize_binding_across_tuple
Sep 15, 2023
Merged

[Unity] Unwrap tuples during CanonicalizeBindings#15696
slyubomirsky merged 1 commit intoapache:unityfrom
Lunderberg:unity_canonicalize_binding_across_tuple

Conversation

@Lunderberg
Copy link
Copy Markdown
Contributor

Prior to this commit, CanonicalizeBindings would identify trivial bindings of var_y = var_x and replace subsequent usage of var_y with var_x, but bindings of the form tuple_var = (var_x,); var_y = var_x[0] would not be canonicalized.

This commit updates the CanonicalizeBindings pass to identify trivial bindings that occur across a TupleGetItem expression, handling them as if they were direct assignments.

Prior to this commit, `CanonicalizeBindings` would identify trivial
bindings of `var_y = var_x` and replace subsequent usage of `var_y`
with `var_x`, but bindings of the form `tuple_var = (var_x,); var_y =
var_x[0]` would not be canonicalized.

This commit updates the `CanonicalizeBindings` pass to identify
trivial bindings that occur across a `TupleGetItem` expression,
handling them as if they were direct assignments.
@Lunderberg Lunderberg force-pushed the unity_canonicalize_binding_across_tuple branch from 4495780 to c013605 Compare September 8, 2023 15:58
Copy link
Copy Markdown
Contributor

@slyubomirsky slyubomirsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great change, thank you!

@slyubomirsky slyubomirsky merged commit 21cdf6c into apache:unity Sep 15, 2023
@Lunderberg Lunderberg deleted the unity_canonicalize_binding_across_tuple branch September 15, 2023 19:47
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