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

slot2ssa: remove TypedSlot #50943

Merged
merged 12 commits into from
Aug 25, 2023
Merged

slot2ssa: remove TypedSlot #50943

merged 12 commits into from
Aug 25, 2023

Commits on Aug 18, 2023

  1. slot2ssa: Insert PiNodes based on bb_vartables

    This is the last usage of TypedSlot (we should be clear now to remove
    that step from the end of type inference now).
    
    Compared to the prior scheme, this now inserts PiNodes at every PhiNode
    corresponding to a given slot, rather than at each load. In principle,
    that should mean that the types we compute across PhiNodes are more
    precise than before.
    
    I believe that means that all slot uses should be at least as precise
    as before, but I haven't completely convinced myself yet.
    topolarity committed Aug 18, 2023
    Configuration menu
    Copy the full SHA
    bc57166 View commit details
    Browse the repository at this point in the history
  2. compiler: Remove TypedSlot

    Since this is now unused by `slot2ssa` downstream, we can happily remove
    it from the rest of the compiler.
    
    There's one more piece of logic that I still need to move downstream: we
    should use the `bb_vartables` for undefined-ness as well. That will
    allow us to finally remove the (now incorrectly named) `annotate_slot_load!`
    topolarity committed Aug 18, 2023
    Configuration menu
    Copy the full SHA
    28df546 View commit details
    Browse the repository at this point in the history
  3. slot2ssa: Remove type iteration

    Now that we have the `bb_vartables` from Inference, we can get a
    converged (and frequently more precise) result for our inserted PhiNodes
    directly, instead of trying to compute the fix point in the optimizer.
    
    This change also improves the way that we are inserting PiNodes to
    ensure that they are present in every block that requires them for
    precision, not just where we are already inserting PhiNodes. This is
    necessary due to the presence of `Conditional`, which means we may
    have a refined type in a block even when dominated by a definition
    whose type was precise outside of the Conditional.
    topolarity committed Aug 18, 2023
    Configuration menu
    Copy the full SHA
    677a08e View commit details
    Browse the repository at this point in the history
  4. slot2ssa: Remove usage of SLOT_USEDUNDEF

    Updates slot2ssa to use the `bb_vartables` for `undef` information.
    As a bonus, evicts the final usage of `tmerge` in slot2ssa.
    
    This also fixes a few crashes from the prior commit, esp. where I was
    emitting PiNode(UndefToken(), Union{}) or where the PhiC nodes were
    not being ordered correctly.
    topolarity committed Aug 18, 2023
    Configuration menu
    Copy the full SHA
    2058927 View commit details
    Browse the repository at this point in the history
  5. Inference: Always update IR to avoid unreachable jumps

    This allows downstream consumers, like the optimizer, to be sure that
    they are only visiting blocks that Inference also visited.
    
    Also update tests and remove some unnused variables in `slot2ssa`.
    topolarity committed Aug 18, 2023
    Configuration menu
    Copy the full SHA
    4bd8d35 View commit details
    Browse the repository at this point in the history
  6. test: Remove check for GotoIfNot

    Now that type inference modifies branches to reflect static control flow
    information, we can't search for the branch that we want to optimize away.
    topolarity committed Aug 18, 2023
    Configuration menu
    Copy the full SHA
    3b6d588 View commit details
    Browse the repository at this point in the history

Commits on Aug 23, 2023

  1. inference: Move unreachable branch updates to convert_to_ircode

    This means that inference modifies types and not IR statements
    themselves. In order to make this happen, we pass have to pass
    per-statement reachability information to the optimizer.
    
    Also fixes up assorted review feedback.
    topolarity committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    d1f3980 View commit details
    Browse the repository at this point in the history
  2. inference: Wrap unreachable stmts in Const(...)

    We were doing this before, but the previous commit had changed it. The
    problem is that the optimizer cannot rely on the `unreachable` vector
    for its external entrypoint.
    
    This restores the existing logic so that type inference will give you a
    result that you can pipe into the optimizer and have it work, although
    suboptimally since we won't be able to prune any unreachable branches.
    topolarity committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    57fb5ed View commit details
    Browse the repository at this point in the history

Commits on Aug 24, 2023

  1. Move unreachable into InferenceState

    I think it'd be a more maintainable data flow to have these results
    collected manually and explicitly passed to the conversion routine for
    the optimizer, but for now this follows the established pattern and
    allows us to create a complete OptimizationState from an InferenceState.
    topolarity committed Aug 24, 2023
    Configuration menu
    Copy the full SHA
    d8d674c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4cf7d5e View commit details
    Browse the repository at this point in the history

Commits on Aug 25, 2023

  1. fix up tests

    aviatesk committed Aug 25, 2023
    Configuration menu
    Copy the full SHA
    afa7b37 View commit details
    Browse the repository at this point in the history
  2. perf improvements

    aviatesk committed Aug 25, 2023
    Configuration menu
    Copy the full SHA
    e234e8f View commit details
    Browse the repository at this point in the history