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

Handle embedded assignments in copy propagation #63447

Merged
merged 4 commits into from
Jan 21, 2022

Commits on Jan 13, 2022

  1. Clean things up a little

    Delete redundant conditions, use "LclVarDsc*", rename locals for clarity.
    SingleAccretion committed Jan 13, 2022
    Configuration menu
    Copy the full SHA
    51c9148 View commit details
    Browse the repository at this point in the history
  2. Delete a redundant condition

    For actual def nodes, GTF_VAR_CAST will never be set, it is
    only set in "optNarrowTree" for uses.
    
    For "def nodes" that are actually uses (parameters), the VNs
    will never match anyway.
    SingleAccretion committed Jan 13, 2022
    Configuration menu
    Copy the full SHA
    01a6e5e View commit details
    Browse the repository at this point in the history
  3. Handle embedded assignments in copy propagation

    Previously, as the comments in copy propagation tell us, it
    did not handle "intervening", or not-top-level definitions of
    locals, instead opting to maintain a dedicated kill set of them.
    
    This is obviously a CQ problem, but also a TP one, as it meant
    there had to be a second pass over the statement's IR, where
    the definitions would be pushed on the stack.
    
    This change does away with that, instead pushing new definitions
    as they are encountered in execution order, and simultaneously
    propagating on uses. Notably, this means the code now needs to
    look at the real definition nodes, i. e. ASGs, not the LHS locals,
    as those are encountered first in canonical execution order, i. e.
    for a tree like:
    
    ```
      ASG
        LCL_VAR V00 "def"
        ADD
          LCL_VAR V00
          LCL_VAR V00
    ```
    
    Were we to use the "def" as the definition point, we would wrongly
    push it as the definition on the stack, even as the assignments
    itself hasn't happened yet at that point.
    
    There are nice diffs with this change, all resulting from unblocked
    propagations, and mostly coming from setup arguments under calls.
    SingleAccretion committed Jan 13, 2022
    Configuration menu
    Copy the full SHA
    4011712 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    db9a3f9 View commit details
    Browse the repository at this point in the history