[Mesa-dev] [PATCH 1/3] glsl: don't run loop passes if loop unrolling is disabled

Marek Olšák maraeo at gmail.com
Wed Nov 9 12:12:39 UTC 2016


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

---
 src/compiler/glsl/glsl_parser_extras.cpp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
index db659adf..0cb3c12 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -2101,26 +2101,28 @@ do_common_optimization(exec_list *ir, bool linked,
    OPT(do_algebraic, ir, native_integers, options);
    OPT(do_lower_jumps, ir);
    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);
 
-   loop_state *ls = analyze_loop_variables(ir);
-   if (ls->loop_found) {
-      OPT(set_loop_controls, ir, ls);
-      OPT(unroll_loops, ir, ls, options);
+   if (options->MaxUnrollIterations) {
+      loop_state *ls = analyze_loop_variables(ir);
+      if (ls->loop_found) {
+         OPT(set_loop_controls, ir, ls);
+         OPT(unroll_loops, ir, ls, options);
+      }
+      delete ls;
    }
-   delete ls;
 
 #undef OPT
 
    return progress;
 }
 
 extern "C" {
 
 /**
  * To be called at GL teardown time, this frees compiler datastructures.
-- 
2.7.4



More information about the mesa-dev mailing list