glsl: don't run loop passes if loop unrolling is disabled
authorMarek Olšák <marek.olsak@amd.com>
Fri, 4 Nov 2016 11:57:53 +0000 (12:57 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 10 Nov 2016 17:34:55 +0000 (18:34 +0100)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/compiler/glsl/glsl_parser_extras.cpp

index db659adf3e0089b78d4944db77cf0584f337d7cd..0cb3c124ea538406bd079293a0960d2ae5284e90 100644 (file)
@@ -2108,12 +2108,14 @@ do_common_optimization(exec_list *ir, bool linked,
    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