Skip to content
  • Timothy Arceri's avatar
    nir: fix selection of loop terminator when two or more have the same limit · 463f8490
    Timothy Arceri authored
    We need to add loop terminators to the list in the order we come
    across them otherwise if two or more have the same exit condition
    we will select that last one rather than the first one even though
    its unreachable.
    
    This fix is for simple unrolls where we only have a single exit
    point. When unrolling these type of loops the unreachable
    terminators and their unreachable branch are removed prior to
    unrolling. Because of the logic change we also switch some
    list access in the complex unrolling logic to avoid breakage.
    
    Fixes: 6772a17a
    
     ("nir: Add a loop analysis pass")
    
    Reviewed-by: default avatarJason Ekstrand <jason@jlekstrand.net>
    463f8490