i965: Remove redundant discard jumps.
authorKenneth Graunke <kenneth@whitecape.org>
Sun, 6 Jul 2014 05:10:41 +0000 (22:10 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 24 Feb 2015 23:24:53 +0000 (15:24 -0800)
commitee3f6745723856419d7f5ecb17652e19855c4caa
tree6d15a94d5c166d62c525f27c181f6c466589686a
parent30f51f1a1a70bc838d5bed449daff0dd9f2e8ef2
i965: Remove redundant discard jumps.

With the previous optimization in place, some shaders wind up with
multiple discard jumps in a row, or jumps directly to the next
instruction.  We can remove those.

Without NIR on Haswell:
total instructions in shared programs: 5777258 -> 5775872 (-0.02%)
instructions in affected programs:     20312 -> 18926 (-6.82%)
helped:                                716

With NIR on Haswell:
total instructions in shared programs: 5773163 -> 5771785 (-0.02%)
instructions in affected programs:     21040 -> 19662 (-6.55%)
helped:                                717

v2: Use the CFG rather than the old instructions list.  Presumably
    the placeholder halt will be in the last basic block.

v3: Make sure placeholder_halt->prev isn't the head sentinel (caught
    twice by Eric Anholt).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_fs.h