i965: make use of nir_lower_returns() for GL
authorTimothy Arceri <timothy.arceri@collabora.com>
Fri, 9 Dec 2016 05:49:10 +0000 (16:49 +1100)
committerTimothy Arceri <timothy.arceri@collabora.com>
Thu, 22 Dec 2016 23:59:32 +0000 (10:59 +1100)
Fixes two new piglit tests:

spec/glsl-1.10/execution/vs-nested-return-sibling-loop.shader_test
spec/glsl-1.10/execution/vs-nested-return-sibling-loop2.shader_test

shader-db results for BDW:

total instructions in shared programs: 12903158 -> 12903134 (-0.00%)
instructions in affected programs: 27100 -> 27076 (-0.09%)
helped: 32
HURT: 6

total cycles in shared programs: 294922518 -> 294922804 (0.00%)
cycles in affected programs: 4372828 -> 4373114 (0.01%)
helped: 31
HURT: 8

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_link.cpp
src/mesa/drivers/dri/i965/brw_program.c

index 0d8a62675628b4c6baf3a0261c8677dd39f2b178..60eb8dce517f247f153cff60d7dece8d2952529c 100644 (file)
@@ -145,12 +145,6 @@ process_glsl_ir(struct brw_context *brw,
          brw_do_vector_splitting(shader->ir);
       }
 
-      progress = do_lower_jumps(shader->ir, true, true,
-                                true, /* main return */
-                                false, /* continue */
-                                false /* loops */
-                                ) || progress;
-
       progress = do_common_optimization(shader->ir, true, true,
                                         options, ctx->Const.NativeIntegers) || progress;
    } while (progress);
index 7f69977e2044773b95da0b3a4ec11ad059728192..fa54c2ac61a2c6dfd90604b524ea1ebf4927ce5d 100644 (file)
@@ -78,6 +78,8 @@ brw_create_nir(struct brw_context *brw,
    if (shader_prog) {
       nir = glsl_to_nir(shader_prog, stage, options);
       nir_remove_dead_variables(nir, nir_var_shader_in | nir_var_shader_out);
+      nir_lower_returns(nir);
+      nir_validate_shader(nir);
       NIR_PASS_V(nir, nir_lower_io_to_temporaries,
                  nir_shader_get_entrypoint(nir), true, false);
    } else {