From 7f8c5844effddddf65770706e1200867f4d53546 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Tue, 20 Apr 2021 12:12:05 -0400 Subject: [PATCH] compiler/glsl: Always propagate_invariance() last Suggested-by: Kenneth Graunke Reviewed-by: Kenneth Graunke Part-of: --- src/compiler/glsl/glsl_parser_extras.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index 90f2328e67c..4e2122160c6 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -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;