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

JIT: optimize redundant branches by looking through phis #76283

Merged
merged 3 commits into from
Sep 29, 2022

Commits on Sep 27, 2022

  1. JIT: optimize redundant branches by looking through phis

    In some cases the value of a block's branch predicate is correlated with the
    predecessor of the block. Often this correlation is hinted at by the presence
    of phis in the predicate's tree and/or phi VNs in in the predicate's VN graph.
    
    For each predecessor of a block, we evaluate the predicate value number using
    the values brought to the block by that predecessor. If we find correlations,
    we use them to drive the existing jump threading optimization.
    
    Also, if we end up partially disambiguating such that there is just one
    remaining predecessor, update the value number of the predicate to reflect
    the values that flow in from that predecessor.
    
    Fixes dotnet#75944.
    Contributes to dotnet#48115.
    AndyAyersMS committed Sep 27, 2022
    Configuration menu
    Copy the full SHA
    d11da11 View commit details
    Browse the repository at this point in the history

Commits on Sep 28, 2022

  1. fix bug

    AndyAyersMS committed Sep 28, 2022
    Configuration menu
    Copy the full SHA
    b7bc291 View commit details
    Browse the repository at this point in the history

Commits on Sep 29, 2022

  1. Proper fix. Both relop VNs may be PhiDefs for the same local, but with

    different SSA def numbers, despite the fact that we don't allow overlapping
    SSA lifetimes. For example there may be a Phi in another block that gets
    copied to some other local and then reaches the current block via that local.
    
    So make sure that when we search local PHIs we also match the ssa def
    number to ensure we're looking at the right PHIs.
    AndyAyersMS committed Sep 29, 2022
    Configuration menu
    Copy the full SHA
    a01346f View commit details
    Browse the repository at this point in the history