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

[DivRemPairs] Do not freeze poisons that can't be undef #92627

Merged
merged 1 commit into from
May 20, 2024

Commits on May 20, 2024

  1. [DivRemPairs] Do not freeze poisons that can't be undef

    Per comments in DivRemPairs, the rewrite from
    ```llvm
        %div = div %X, %Y
        %rem = rem %X, %Y
    ```
    to
    ```llvm
        %div = div %X, %Y
        %.mul = mul %div, %Y
        %rem = sub %X, %mul
    ```
    is unsound when %X or %Y are undef.
    
    However, it is known to be sound if %X or %Y are poison but can't be
    undef, since both the pre- and post-rewrite %rem are `poison`.
    
    Additionally, proofs: https://alive2.llvm.org/ce/z/xtNQ8j
    
    A comment in the pass listed a TODO for changing a usage of
    isGuaranteedNotToBeUndefOrPoison() in the pass to something that only
    detects undef. Such a function has been implemented since the time
    that TODO was written, but has not been used.
    
    Therefore, this commit updates DivRemPairs to use
    isGuaranteedNotToBeUndef() instead.
    krzysz00 committed May 20, 2024
    Configuration menu
    Copy the full SHA
    58c5147 View commit details
    Browse the repository at this point in the history