[Mesa-dev] [PATCH v2 00/14] NIR dead control-flow removal

Connor Abbott cwabbott0 at gmail.com
Thu May 21 09:40:55 PDT 2015


This is the second version of my dead control-flow series. In addition
to fixing up a few things pointed out by Jason and cleaning up a few
other odds and ends, I've fixed a number of bugs caught by disabling
opt_if_simplification in GLSL IR as in the last patch. In particular,
patch 5 deals with rewriting phi nodes when deleting control flow,
something I forgot when doing the original series.

I've run the series, including the last patch which is just for testing,
through piglit and there are no regressions except for
shaders/glsl-const-folding-01, which is due to the last patch disabling
the GLSL IR optimization that the test is relying on, and
glslparsertest/shaders/correctfull.frag, which now crashes in the i965
fs backend -- it seems to be an issue with i965, and not NIR, that was
uncovered after NIR was made more aggressive. I've also verified that
the public shader-db doesn't crash with this series (including the last
patch), and manually tested some of the tricker cases, although it would
be a good idea to run the entire thing through the private shader-db
too.

This series is also available at

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

Connor Abbott (14):
  nir/vars_to_ssa: don't rewrite removed instructions
  nir: insert ssa_undef instructions when cleaning up defs/uses
  nir: cleanup cf nodes earlier in nir_cf_node_remove()
  nir: properly clean up jumps when removing cf nodes
  nir: fix up phi nodes when removing cf nodes
  nir: add nir_cf_node_remove_after()
  nir/validate: validate successors at the end of a loop
  nir: add an optimization for removing dead control flow
  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
  XXX disable opt_if_simplification

 src/glsl/Makefile.sources            |   1 +
 src/glsl/glsl_parser_extras.cpp      |   2 +-
 src/glsl/nir/nir.c                   | 243 +++++++++++++++++++++++--
 src/glsl/nir/nir.h                   |  17 ++
 src/glsl/nir/nir_lower_vars_to_ssa.c |   3 +-
 src/glsl/nir/nir_opt_dead_cf.c       | 342 +++++++++++++++++++++++++++++++++++
 src/glsl/nir/nir_validate.c          |  21 +++
 src/mesa/drivers/dri/i965/brw_nir.c  |   2 +
 8 files changed, 615 insertions(+), 16 deletions(-)
 create mode 100644 src/glsl/nir/nir_opt_dead_cf.c

-- 
2.1.0



More information about the mesa-dev mailing list