• Timothy Arceri's avatar
    nir: evaluate if condition uses inside the if branches · f1638178
    Timothy Arceri authored
    Since we know what side of the branch we ended up on we can just
    replace the use with a constant.
    
    All helped shaders are from Unreal Engine 4 besides one shader from
    Dirt Showdown.
    
    V2: make sure we do evaluation when condition is used in else with
        a single block (we were checking for blocks < the last else
        block rather than <=)
    
    shader-db results SKL:
    
    total instructions in shared programs: 13219725 -> 13219643 (<.01%)
    instructions in affected programs: 28917 -> 28835 (-0.28%)
    helped: 45
    HURT: 0
    
    total cycles in shared programs: 529335971 -> 529334604 (<.01%)
    cycles in affected programs: 216209 -> 214842 (-0.63%)
    helped: 45
    HURT: 4
    
    Cc: Ian Romanick <idr@freedesktop.org>
    
    fix if condition eval for else with a single block
    f1638178
nir_opt_if.c 16.9 KB