[Mesa-dev] [PATCH 3/7] glsl: run do_lower_jumps properly in do_common_optimizations

Marek Olšák maraeo at gmail.com
Sun Jan 1 00:34:28 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

so that backends don't have to run it manually
---
 src/compiler/glsl/glsl_parser_extras.cpp   | 3 ++-
 src/mesa/program/ir_to_mesa.cpp            | 2 --
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 8 +-------
 3 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
index 4566aa9..b12cf3d 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -2099,21 +2099,22 @@ do_common_optimization(exec_list *ir, bool linked,
    OPT(do_tree_grafting, ir);
    OPT(do_constant_propagation, ir);
    if (linked)
       OPT(do_constant_variable, ir);
    else
       OPT(do_constant_variable_unlinked, ir);
    OPT(do_constant_folding, ir);
    OPT(do_minmax_prune, ir);
    OPT(do_rebalance_tree, ir);
    OPT(do_algebraic, ir, native_integers, options);
-   OPT(do_lower_jumps, ir);
+   OPT(do_lower_jumps, ir, true, true, options->EmitNoMainReturn,
+       options->EmitNoCont, options->EmitNoLoops);
    OPT(do_vec_index_to_swizzle, ir);
    OPT(lower_vector_insert, ir, false);
    OPT(do_swizzle_swizzle, ir);
    OPT(do_noop_swizzle, ir);
 
    OPT(optimize_split_arrays, ir, linked);
    OPT(optimize_redundant_jumps, ir);
 
    if (options->MaxUnrollIterations) {
       loop_state *ls = analyze_loop_variables(ir);
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 653b822..0089e80 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2972,22 +2972,20 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
 
       do {
 	 progress = false;
 
 	 /* Lowering */
 	 do_mat_op_to_vec(ir);
 	 lower_instructions(ir, (MOD_TO_FLOOR | DIV_TO_MUL_RCP | EXP_TO_EXP2
 				 | LOG_TO_LOG2 | INT_DIV_TO_MUL_RCP
 				 | ((options->EmitNoPow) ? POW_TO_EXP2 : 0)));
 
-	 progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress;
-
 	 progress = do_common_optimization(ir, true, true,
                                            options, ctx->Const.NativeIntegers)
 	   || progress;
 
 	 progress = lower_quadop_vector(ir, true) || progress;
 
 	 if (options->MaxIfDepth == 0)
 	    progress = lower_discard(ir) || progress;
 
 	 progress = lower_if_to_cond_assign((gl_shader_stage)i, ir,
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index f738084..59d4d69 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -6889,28 +6889,22 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
 
       do_vec_index_to_cond_assign(ir);
       lower_vector_insert(ir, true);
       lower_quadop_vector(ir, false);
       lower_noise(ir);
       if (options->MaxIfDepth == 0) {
          lower_discard(ir);
       }
 
       do {
-         progress = false;
-
-         progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress;
-
          progress = do_common_optimization(ir, true, true, options,
-                                           ctx->Const.NativeIntegers)
-           || progress;
-
+                                           ctx->Const.NativeIntegers);
          progress = lower_if_to_cond_assign((gl_shader_stage)i, ir,
                                             options->MaxIfDepth, if_threshold) ||
                     progress;
 
       } while (progress);
 
       validate_ir_tree(ir);
    }
 
    build_program_resource_list(ctx, prog);
-- 
2.7.4



More information about the mesa-dev mailing list