nir: propagates if condition evaluation down some alu chains
authorTimothy Arceri <tarceri@itsqueeze.com>
Mon, 23 Jul 2018 04:38:34 +0000 (14:38 +1000)
committerTimothy Arceri <tarceri@itsqueeze.com>
Fri, 14 Sep 2018 06:07:36 +0000 (16:07 +1000)
commit2975422ceb6cc4f8697279f69701aaa2c036d123
tree4c11018cad37431c4fca51968ef9e16ec104dbd0
parentef4ad7baf176fe1820c7ec771b8c801efcbc4846
nir: propagates if condition evaluation down some alu chains

v2:
 - only allow nir_op_inot or nir_op_b2i when alu input is 1.
 - use some helpers as suggested by Jason.

v3:
 - evaluate alu op for single input alu ops
 - add helper function to decide if to propagate through alu
 - make use of nir_before_src in another spot

shader-db IVB results:

total instructions in shared programs: 9993483 -> 9993472 (-0.00%)
instructions in affected programs: 1300 -> 1289 (-0.85%)
helped: 11
HURT: 0

total cycles in shared programs: 219476091 -> 219476059 (-0.00%)
cycles in affected programs: 7675 -> 7643 (-0.42%)
helped: 10
HURT: 1

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir_opt_if.c