From: Caio Marcelo de Oliveira Filho Date: Tue, 5 May 2020 15:57:12 +0000 (-0700) Subject: nir: Use deref intrinsics to set writes_memory when gathering info X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d89c28d314b909ebbe94203170b76b82acaa249c;p=mesa.git nir: Use deref intrinsics to set writes_memory when gathering info Reviewed-by: Kenneth Graunke Part-of: --- diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c index f62adb6e1f4..09ecc28554b 100644 --- a/src/compiler/nir/nir_gather_info.c +++ b/src/compiler/nir/nir_gather_info.c @@ -279,6 +279,20 @@ try_mask_partial_io(nir_shader *shader, nir_variable *var, return true; } +static void +update_memory_written_for_deref(nir_shader *shader, nir_deref_instr *deref) +{ + switch (deref->mode) { + case nir_var_mem_ssbo: + case nir_var_mem_global: + shader->info.writes_memory = true; + break; + default: + /* Nothing to do. */ + break; + } +} + static void gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader, void *dead_ctx) @@ -326,6 +340,8 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader, } } } + if (instr->intrinsic == nir_intrinsic_store_deref) + update_memory_written_for_deref(shader, deref); break; } @@ -471,6 +487,19 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader, shader->info.writes_memory = true; break; + case nir_intrinsic_deref_atomic_add: + case nir_intrinsic_deref_atomic_imin: + case nir_intrinsic_deref_atomic_umin: + case nir_intrinsic_deref_atomic_imax: + case nir_intrinsic_deref_atomic_umax: + case nir_intrinsic_deref_atomic_and: + case nir_intrinsic_deref_atomic_or: + case nir_intrinsic_deref_atomic_xor: + case nir_intrinsic_deref_atomic_exchange: + case nir_intrinsic_deref_atomic_comp_swap: + update_memory_written_for_deref(shader, nir_src_as_deref(instr->src[0])); + break; + default: break; }