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

[DCE] Tweaked code to end borrows before destroys. #39760

Commits on Oct 19, 2021

  1. [DCE] Tweaked code to end borrows before destroys.

    If a phi argument is dead and it reborrowing it was dependent on some
    other value, that other value on which it was dependent may have already
    itself been deleted.  In that case, the destroy_value would have been
    added just before the terminator of the predecessors of the block which
    contained the dead phi.  So, when deciding where to insert the
    end_borrow, iterate backwards from the end of the block, skipping the
    terminator updating the insertion point every time a destroy_value
    instruction is encountered until we hit an instruction with a different
    opcode.  This ensures that no matter how many destroy_values may have
    been added just before the terminator, the end_borrow will preceed them.
    
    This commit just tweaks the preexisting logic that checked for this
    condition.  Specifically, the previous code didn't handle the case where
    the block contains only a terminator and a destroy_value.
    nate-chandler committed Oct 19, 2021
    Configuration menu
    Copy the full SHA
    4d92cce View commit details
    Browse the repository at this point in the history