compiler/glsl: Always propagate_invariance() last
authorMatt Turner <mattst88@gmail.com>
Tue, 20 Apr 2021 16:12:05 +0000 (12:12 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 20 Apr 2021 18:54:57 +0000 (18:54 +0000)
Suggested-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10292>

src/compiler/glsl/glsl_parser_extras.cpp

index 90f2328..4e21221 100644 (file)
@@ -2413,6 +2413,16 @@ do_common_optimization(exec_list *ir, bool linked,
       delete ls;
    }
 
+   /* If the PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY cap is set, this pass will
+    * only be called once rather than repeatedly until no further progress is
+    * made.
+    *
+    * If an optimization pass fails to preserve the invariant flag, calling
+    * the pass only once may result in incorrect code generation. Always call
+    * propagate_invariance() last to avoid this possibility.
+    */
+   OPT(propagate_invariance, ir);
+
 #undef OPT
 
    return progress;