From b4ad27a986e1c6899cbf23355c3e9c6de345a323 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Mon, 23 Nov 2020 14:28:52 -0800 Subject: [PATCH] freedreno/ir3: Use get_once() for one-time init Signed-off-by: Rob Clark Reviewed-by: Kristian H. Kristensen Part-of: --- src/freedreno/ir3/ir3_nir.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/freedreno/ir3/ir3_nir.c b/src/freedreno/ir3/ir3_nir.c index 8a3f768d995..cf2603af963 100644 --- a/src/freedreno/ir3/ir3_nir.c +++ b/src/freedreno/ir3/ir3_nir.c @@ -204,9 +204,8 @@ ir3_optimize_loop(nir_shader *s) progress |= OPT(s, nir_copy_prop); progress |= OPT(s, nir_opt_dce); progress |= OPT(s, nir_opt_cse); - static int gcm = -1; - if (gcm == -1) - gcm = env_var_as_unsigned("GCM", 0); + + int gcm = get_once(env_var_as_unsigned("GCM", 0)); if (gcm == 1) progress |= OPT(s, nir_opt_gcm, true); else if (gcm == 2)