nir: add opt_if_loop_terminator()
authorTimothy Arceri <tarceri@itsqueeze.com>
Fri, 1 Jun 2018 05:37:28 +0000 (15:37 +1000)
committerTimothy Arceri <tarceri@itsqueeze.com>
Thu, 7 Jun 2018 01:33:04 +0000 (11:33 +1000)
commit2a74296f24ba15b14602286a680ca5f344a71059
treea4c7e47f0692eeab574dca96d797debe1e5d4ff9
parent1098bc5e854a1253e050fa30d16eda6ca676d4b3
nir: add opt_if_loop_terminator()

This pass detects potential loop terminators and moves intructions
from the non breaking branch after the if-statement.

This enables both the new opt_if_simplification() pass and loop
unrolling to potentially progress further.

Unexpectedly this change speed up shader-db run times by ~3%

Ivy Bridge shader-db results (all changes in dolphin/ubershaders):

total instructions in shared programs: 9995662 -> 9995338 (-0.00%)
instructions in affected programs: 87845 -> 87521 (-0.37%)
helped: 27
HURT: 0

total cycles in shared programs: 230931495 -> 230925015 (-0.00%)
cycles in affected programs: 56391385 -> 56384905 (-0.01%)
helped: 27
HURT: 0

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/compiler/nir/nir_opt_if.c