[Mesa-dev] [PATCH 0/9] NIR dead control-flow removal

Connor Abbott cwabbott0 at gmail.com
Fri May 8 22:03:26 PDT 2015


This series implements a bunch of related optimizations that run at
once as part of the same pass to eliminate control flow that is
useless. This includes both unreachable code and useless loops, i.e.
loops that don't compute a result used by the rest of the code. To do
this, I needed to change some low-level things that change the behavior
of nir_instr_remove() (see patch 2 for details), but I've tested the
series on piglit and there are no regressions, and there are no
shader-db changes either.

This is rebased on Jason's series to use lists for use-def sets; it
turns out that the changes required were pretty minimal.

The series is also available at:

git://people.freedesktop.org/~cwabbott0/mesa nir-dead-cf-v3

Connor Abbott (9):
  nir/vars_to_ssa: don't rewrite removed instructions
  nir: insert ssa_undef instructions when cleanup up defs/uses
  nir: add an optimization for removing dead control flow
  nir/validate: validate successors at the end of a loop
  nir/dead_cf: delete code that's unreachable due to jumps
  nir: add nir_block_get_following_loop() helper
  nir: add a helper for iterating over blocks in a cf node
  nir/dead_cf: add support for removing useless loops
  i965/fs/nir: enable the dead control flow optimization

 src/glsl/Makefile.sources            |   1 +
 src/glsl/nir/nir.c                   |  94 ++++++++--
 src/glsl/nir/nir.h                   |  12 ++
 src/glsl/nir/nir_lower_vars_to_ssa.c |   3 +-
 src/glsl/nir/nir_opt_dead_cf.c       | 332 +++++++++++++++++++++++++++++++++++
 src/glsl/nir/nir_validate.c          |  21 +++
 src/mesa/drivers/dri/i965/brw_nir.c  |   2 +
 7 files changed, 452 insertions(+), 13 deletions(-)
 create mode 100644 src/glsl/nir/nir_opt_dead_cf.c

-- 
2.1.0



More information about the mesa-dev mailing list