When analyzing output for glsl-mat-from-int-ctor-03 piglit test, found that the following piece of generated asm code:
mov(8) g19<1>.xyzF g6<4,4,1>.xyzzD { align16 1Q }; dp4(8) g115<1>.wF g4<4,4,1>F g2.4<0,4,1>F { align16 NoDDChk 1Q }; cmp.nz.f0(8) null<1>F g11<4,4,1>.xyzzF g19<4,4,1>.xyzzF { align16 1Q switch }; cmp.nz.f0(8) null<1>D g7<4,4,1>D 0D { align16 1Q switch }; (+f0.any4h) mov(8) g21<1>.xUD 0xffffffffUD { align16 1Q }; can be further optimized if we remove the former cmp instruction, as the output is overwritten by the second one (a clearly dead-code). The reason why this was not optimized is in vec4_visitor::run() (brw_vec4.cpp file). If opt_vector_float() success, then we apply several optimizations once, including a dead-code eliminate. But turns out that running this DCE optimization leds to the code above, and as we don't run again the DCE (we don't run them in a loop), the code remains as above. So this commit run all those optimizations in a loop. More strictly, instead of running them in a separated loop, it runs them in the previous loop, with all the other optimizations. When testing against the improvement obtained against shader-db, we don't get any improvement (nor any loose). But testing also against the non-free shaders in shader-db, we get the following improvement: total instructions in shared programs: 6819828 -> 6819468 (-0.01%) instructions in affected programs: 30516 -> 30156 (-1.18%) total loops in shared programs: 1971 -> 1971 (0.00%) helped: 154 HURT: 0 GAINED: 0 LOST: 0 Signed-off-by: Juan A. Suarez Romero <jasua...@igalia.com> --- src/mesa/drivers/dri/i965/brw_vec4.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp index 9a79d67..39e525d 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp @@ -1846,19 +1846,15 @@ vec4_visitor::run() OPT(opt_copy_propagation); OPT(opt_cmod_propagation); OPT(opt_cse); - OPT(opt_algebraic); OPT(opt_register_coalesce); OPT(eliminate_find_live_channel); - } while (progress); - - pass_num = 0; - - if (OPT(opt_vector_float)) { + OPT(opt_algebraic); + OPT(opt_vector_float); OPT(opt_cse); OPT(opt_copy_propagation, false); OPT(opt_copy_propagation, true); OPT(dead_code_eliminate); - } + } while (progress); if (failed) return false; -- 2.5.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev