Skip to content
  • Ian Romanick's avatar
    nir: Use De Morgan's Law on logic compounded comparisons · d1ed4ffe
    Ian Romanick authored
    
    
    The replacement of the comparison operators must happen during this
    step.  If it does not, the next pass of nir_opt_algebraic will reapply
    De Morgan's Law in the "opposite direction" before performing dead code
    elimination.  The resulting infinite loop will eventually get OOM
    killed.
    
    Haswell, Broadwell, and Skylake had similar results. (Broadwell shown)
    total instructions in shared programs: 14808185 -> 14808036 (<.01%)
    instructions in affected programs: 13758 -> 13609 (-1.08%)
    helped: 39
    HURT: 0
    helped stats (abs) min: 1 max: 10 x̄: 3.82 x̃: 3
    helped stats (rel) min: 0.44% max: 1.55% x̄: 0.98% x̃: 1.01%
    95% mean confidence interval for instructions value: -4.67 -2.97
    95% mean confidence interval for instructions %-change: -1.09% -0.88%
    Instructions are helped.
    
    total cycles in shared programs: 559438333 -> 559435832 (<.01%)
    cycles in affected programs: 199160 -> 196659 (-1.26%)
    helped: 42
    HURT: 3
    helped stats (abs) min: 2 max: 184 x̄: 61.50 x̃: 51
    helped stats (rel) min: 0.02% max: 6.94% x̄: 1.41% x̃: 1.40%
    HURT stats (abs)   min: 2 max: 40 x̄: 27.33 x̃: 40
    HURT stats (rel)   min: 0.05% max: 0.74% x̄: 0.51% x̃: 0.74%
    95% mean confidence interval for cycles value: -71.47 -39.69
    95% mean confidence interval for cycles %-change: -1.64% -0.93%
    Cycles are helped.
    
    Sandy Bridge and Ivy Bridge had similar results. (Ivy Bridge shown)
    total instructions in shared programs: 11811776 -> 11811553 (<.01%)
    instructions in affected programs: 15201 -> 14978 (-1.47%)
    helped: 39
    HURT: 0
    helped stats (abs) min: 1 max: 20 x̄: 5.72 x̃: 6
    helped stats (rel) min: 0.44% max: 2.53% x̄: 1.30% x̃: 1.26%
    95% mean confidence interval for instructions value: -7.21 -4.23
    95% mean confidence interval for instructions %-change: -1.48% -1.12%
    Instructions are helped.
    
    total cycles in shared programs: 257617270 -> 257614589 (<.01%)
    cycles in affected programs: 212107 -> 209426 (-1.26%)
    helped: 45
    HURT: 0
    helped stats (abs) min: 2 max: 180 x̄: 59.58 x̃: 54
    helped stats (rel) min: 0.02% max: 6.02% x̄: 1.30% x̃: 1.32%
    95% mean confidence interval for cycles value: -74.02 -45.14
    95% mean confidence interval for cycles %-change: -1.59% -1.01%
    Cycles are helped.
    
    Iron Lake
    total instructions in shared programs: 7886648 -> 7886515 (<.01%)
    instructions in affected programs: 14106 -> 13973 (-0.94%)
    helped: 29
    HURT: 0
    helped stats (abs) min: 1 max: 10 x̄: 4.59 x̃: 4
    helped stats (rel) min: 0.35% max: 1.83% x̄: 0.90% x̃: 0.81%
    95% mean confidence interval for instructions value: -5.65 -3.52
    95% mean confidence interval for instructions %-change: -1.03% -0.76%
    Instructions are helped.
    
    total cycles in shared programs: 178100812 -> 178100396 (<.01%)
    cycles in affected programs: 67970 -> 67554 (-0.61%)
    helped: 29
    HURT: 0
    helped stats (abs) min: 2 max: 40 x̄: 14.34 x̃: 12
    helped stats (rel) min: 0.15% max: 1.69% x̄: 0.58% x̃: 0.54%
    95% mean confidence interval for cycles value: -18.30 -10.39
    95% mean confidence interval for cycles %-change: -0.71% -0.45%
    Cycles are helped.
    
    GM45
    total instructions in shared programs: 4857939 -> 4857872 (<.01%)
    instructions in affected programs: 7426 -> 7359 (-0.90%)
    helped: 15
    HURT: 0
    helped stats (abs) min: 1 max: 10 x̄: 4.47 x̃: 4
    helped stats (rel) min: 0.33% max: 1.80% x̄: 0.87% x̃: 0.77%
    95% mean confidence interval for instructions value: -6.06 -2.87
    95% mean confidence interval for instructions %-change: -1.06% -0.67%
    Instructions are helped.
    
    total cycles in shared programs: 122167930 -> 122167654 (<.01%)
    cycles in affected programs: 43118 -> 42842 (-0.64%)
    helped: 15
    HURT: 0
    helped stats (abs) min: 4 max: 40 x̄: 18.40 x̃: 16
    helped stats (rel) min: 0.15% max: 1.69% x̄: 0.62% x̃: 0.54%
    95% mean confidence interval for cycles value: -25.03 -11.77
    95% mean confidence interval for cycles %-change: -0.82% -0.41%
    Cycles are helped.
    
    Signed-off-by: default avatarIan Romanick <ian.d.romanick@intel.com>
    Reviewed-by: default avatarSamuel Iglesias Gonsálvez <siglesias@igalia.com>
    d1ed4ffe