On Fri, May 8, 2015 at 10:03 PM, Connor Abbott <cwabbo...@gmail.com> wrote: > 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.
I tried to get you shader-db results, but it crashes part-way through. In particular, it looks like unigen heaven on high will crash it. Either that or a couple of synmark shaders but I doubt those are the culprets. I think it's also worth noting that piglit probably isn't a good test of whether or not this works. I doubt there are many piglit shaders with dead control-flow and I think GLSL IR can get rid of it in some of the common cases. If you wanted to "generate NIR" to test with, you could always hack up my SPIRV -> NIR branch to run an optimization loop after converting. Then you can see what happens without GLSL IR in the way. --Jason > 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 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev