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

[LoopVersioning] Add a check to see if the input loop is in LCSSA form #116443

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Nov 15, 2024

  1. [LoopVersioning] Add a check to see if the input loop is in LCSSA form

    Loop Optimizations expect the input loop to be in LCSSA form. But it seems
    that LoopVersioning doesn't have any check to see if the loop is actually in
    LCSSA form. As a result, if we give it a loop which is not in LCSSA form but
    still correct semantically, the resulting transformation fails to pass through
    verifier pass with the following error.
    
    Instruction does not dominate all uses!
    %inc = add nsw i16 undef, 1
    store i16 %inc, ptr @c, align 1
    
    As the loop is not in LCSSA form, LoopVersioning's transformations leads to
    invalid IR! As some instructions do not dominate all their uses.
    
    This patch checks if a loop is in LCSSA form, if not it will call
    formLCSSARecursively on the loop before passing it to LoopVersioning.
    
    Fixes: llvm#36998
    VedantParanjape committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    bfc6152 View commit details
    Browse the repository at this point in the history