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

[SSA] Fix bug in to_ssa.py #111

Merged
merged 1 commit into from
Jan 3, 2021
Merged

[SSA] Fix bug in to_ssa.py #111

merged 1 commit into from
Jan 3, 2021

Commits on Jan 3, 2021

  1. [SSA] Fix bug in to_ssa.py

    Fixes Issue sampsyo#108.
    
    The optimization in prune_phis() is not sound. phi nodes that are
    "partially undefined" cannot be removed. It is only illegal to read
    from the result if the second to last executed label corresponds to
    an undefined argument. `to_ssa.py` generated incorrect code for the
    two tests added, before the fix.
    
    In most cases, these phi nodes aren't read from, and will be removed
    by DCE. However, in the case where the phi nodes are read, a correct
    optimization would be:
    1. Detect partially undefined phi nodes whose value is always used.
       Let `undefined_labels` be the set of labels whose argument is
       undefined.
    2. Leverage the undefined behavior to say that `undefined_labels`
       are in fact not predecessors to the basic block.
       `preds = preds - undefined_labels`.
    Though, I'm not sure how useful that optimization would be in
    practice.
    terrelln committed Jan 3, 2021
    Configuration menu
    Copy the full SHA
    852ea80 View commit details
    Browse the repository at this point in the history