diff options
author | Matt Turner <[email protected]> | 2016-02-04 12:04:42 -0800 |
---|---|---|
committer | Matt Turner <[email protected]> | 2016-02-08 20:38:17 -0800 |
commit | 7be8d07732295bd546130d9c8c8fb8ff64490686 (patch) | |
tree | e3177f7085e621cecc079b9c9699a06ef1525e32 /src/compiler/nir/nir_algebraic.py | |
parent | a8f0960816e868783d56edac1851a6d218e09c5a (diff) |
nir: Do opt_algebraic in reverse order.
Walking the SSA definitions in order means that we consider the smallest
algebraic optimizations before larger optimizations. So if a smaller
rule is part of a larger rule, the smaller one will happen first,
preventing the larger one from happening.
instructions in affected programs: 32721 -> 32611 (-0.34%)
helped: 106
In programs whose nir_optimize loop count changes (129 of them):
before: 1164 optimization loops
after: 1071 optimization loops
Of the 129 affected, 16 programs' optimization loop counts increased.
Prevents regressions and annoyances in the next commits.
Reviewed-by: Eduardo Lima Mitev <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_algebraic.py')
-rw-r--r-- | src/compiler/nir/nir_algebraic.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/nir_algebraic.py index a30652f2afd..77ad35eda2a 100644 --- a/src/compiler/nir/nir_algebraic.py +++ b/src/compiler/nir/nir_algebraic.py @@ -216,7 +216,7 @@ ${pass_name}_block(nir_block *block, void *void_state) { struct opt_state *state = void_state; - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_reverse_safe(block, instr) { if (instr->type != nir_instr_type_alu) continue; @@ -255,7 +255,7 @@ ${pass_name}_impl(nir_function_impl *impl, const bool *condition_flags) state.progress = false; state.condition_flags = condition_flags; - nir_foreach_block(impl, ${pass_name}_block, &state); + nir_foreach_block_reverse(impl, ${pass_name}_block, &state); if (state.progress) nir_metadata_preserve(impl, nir_metadata_block_index | |