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 <jenatali@microsoft.com> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>
This commit is contained in:

committed by
Marge Bot

parent
fff78fc1c5
commit
0f94ff8a6a
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user