From 0f94ff8a6ac7a876cf0bdfaa2a618217ff79fce1 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Sun, 1 Nov 2020 17:22:19 -0600 Subject: [PATCH] nir: Only force loop unrolling if we know it's a in/out/temp If we don't know the actual mode then we can't get to the variable so it's going to be a scratch or other indirect load anyway and we aren't saving ourselves anything by unrolling the loop. Reviewed-by: Jesse Natalie Reviewed-by: Caio Marcelo de Oliveira Filho Part-of: --- src/compiler/nir/nir_loop_analyze.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/compiler/nir/nir_loop_analyze.c b/src/compiler/nir/nir_loop_analyze.c index d13dd70d7d9..7cd3b60430b 100644 --- a/src/compiler/nir/nir_loop_analyze.c +++ b/src/compiler/nir/nir_loop_analyze.c @@ -1112,11 +1112,13 @@ force_unroll_array_access(loop_info_state *state, nir_deref_instr *deref) unsigned array_size = find_array_access_via_induction(state, deref, NULL); if (array_size) { if ((array_size == state->loop->info->max_trip_count) && - (deref->mode & (nir_var_shader_in | nir_var_shader_out | - nir_var_shader_temp | nir_var_function_temp))) + nir_deref_mode_must_be(deref, nir_var_shader_in | + nir_var_shader_out | + nir_var_shader_temp | + nir_var_function_temp)) return true; - if (deref->mode & state->indirect_mask) + if (nir_deref_mode_must_be(deref, state->indirect_mask)) return true; }