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

updating domtrees dynamically, removing all unreachable blocks #33730

Closed
wants to merge 16 commits into from

Commits on Aug 3, 2020

  1. Decline to remove phi nodes when this might cause forward references

    Phi nodes are optimized away when there is only one predecessor, but this can
    cause problems in dead loops because forward references can be created, leading
    to issues with optimization passes that look at all code, dead or not. This
    fixes issue JuliaLang#29107 when DCE is turned on.
    yhls committed Aug 3, 2020
    Configuration menu
    Copy the full SHA
    bb6e299 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    714e28c View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    1c9d498 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    32fbdce View commit details
    Browse the repository at this point in the history
  5. Fix bug in which uses of SSA values processed in just_fixup! were n…

    …ot counted
    
    This fixes JuliaLang#29253, which was caused by `simple_dce!` erroneously erasing SSA
    values that did not appear to be used, because these uses were only discovered
    in `just_fixup!` at the end of iterating over an `IncrementalCompact`.
    yhls committed Aug 3, 2020
    Configuration menu
    Copy the full SHA
    425939e View commit details
    Browse the repository at this point in the history
  6. Fix small bug in JuliaLang#36684

    PR JuliaLang#36684 changes `iterate(IncrementalCompact)` to return an extra index, but
    leaves its arguments unchanged. However, the PR decremented the index argument
    in a particular recursive call to `iterate`. This caused `iterate` not to
    recognise that it was done when `allow_cfg_transforms` was turned on.
    yhls committed Aug 3, 2020
    Configuration menu
    Copy the full SHA
    9fd6420 View commit details
    Browse the repository at this point in the history
  7. Implement algorithm for updating dominator tree with CFG edge inserti…

    …ons and deletions
    
    The DFS tree associated with a CFG now keeps track of postorder as well as
    preorder numbers. The DFS tree, as well as the state associated with the SNCA
    algorithm for finding (immediate) dominators is now stored in DomTree and
    reused for Dynamic SNCA.
    yhls committed Aug 3, 2020
    Configuration menu
    Copy the full SHA
    524452b View commit details
    Browse the repository at this point in the history
  8. Remove dead blocks as determined by reachability instead of number of…

    … predecessors
    
    For now, just construct the domtree when we make an `IncrementalCompact` rather
    than try to update it (the domtree) incrementally.
    yhls committed Aug 3, 2020
    Configuration menu
    Copy the full SHA
    c73f19e View commit details
    Browse the repository at this point in the history
  9. Make domtree construction take Vector{BasicBlock} as input instead …

    …of CFG
    
    This is in anticipation of domtrees being added to CFGs.
    yhls committed Aug 3, 2020
    Configuration menu
    Copy the full SHA
    12b34fe View commit details
    Browse the repository at this point in the history
  10. Add a domtree to every CFG, avoiding constructing them explicitly whe…

    …n needed
    
    Every time a CFG is created, its corresponding dominator tree is as well.
    yhls committed Aug 3, 2020
    Configuration menu
    Copy the full SHA
    88534d5 View commit details
    Browse the repository at this point in the history
  11. Update domtrees dynamically when CFGs get modified, and fix bug in dy…

    …namic domtree implementation
    yhls committed Aug 3, 2020
    Configuration menu
    Copy the full SHA
    07f5c08 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    e2e00b0 View commit details
    Browse the repository at this point in the history
  13. Kill statements in blocks that are unreachable, add tests for killing…

    … edges
    
    This change only affects statements that we have yet to encounter after killing
    an edge, while iterating through `IncrementalCompact`. Statements in dead
    blocks that come before the point at which the edge is killed are killed in
    `kill_edge!`, when the edge is killed.
    yhls committed Aug 3, 2020
    Configuration menu
    Copy the full SHA
    17a6999 View commit details
    Browse the repository at this point in the history
  14. Fix infinite loop bug in kill_edge!

    If a statement was `nothing`, `kill_edge!` would never move on from trying to
    kill it because the index wasn't incremented.
    yhls committed Aug 3, 2020
    Configuration menu
    Copy the full SHA
    0b3c63c View commit details
    Browse the repository at this point in the history
  15. Move BasicBlock to separate source file

    This is so we can add type declarations to fields in ir.jl that are domtrees,
    by breaking the dependency loop between domtree.jl (uses basic blocks but
    defines domtrees) and ir.jl (uses domtrees but defined basic blocks).
    yhls committed Aug 3, 2020
    Configuration menu
    Copy the full SHA
    ff20764 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    6a250c4 View commit details
    Browse the repository at this point in the history