nir: Handle more barriers in dead_write and copy_prop
authorJason Ekstrand <jason@jlekstrand.net>
Tue, 7 Jan 2020 20:11:55 +0000 (14:11 -0600)
committerMarge Bot <eric+marge@anholt.net>
Mon, 13 Jan 2020 17:23:46 +0000 (17:23 +0000)
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3307>

src/compiler/nir/nir_opt_copy_prop_vars.c
src/compiler/nir/nir_opt_dead_write_vars.c

index c4544eac0f2bee7ec4a60c6e2ee7ccb640e58e43..fdbf62c3599a5c7fe1da4fe94809253808debc11 100644 (file)
@@ -807,6 +807,19 @@ copy_prop_vars_block(struct copy_prop_var_state *state,
                                          nir_var_mem_shared);
          break;
 
+      case nir_intrinsic_memory_barrier_buffer:
+      case nir_intrinsic_memory_barrier_atomic_counter:
+         if (debug) dump_instr(instr);
+
+         apply_barrier_for_modes(copies, nir_var_mem_ssbo);
+         break;
+
+      case nir_intrinsic_memory_barrier_shared:
+         if (debug) dump_instr(instr);
+
+         apply_barrier_for_modes(copies, nir_var_mem_shared);
+         break;
+
       case nir_intrinsic_scoped_memory_barrier:
          if (debug) dump_instr(instr);
 
index 201e0847ce945252f5c64c3baa6d2b042d7c0a1f..ffe0de771daf8584ec39896612d074b3b853b33e 100644 (file)
@@ -139,6 +139,15 @@ remove_dead_write_vars_local(void *mem_ctx, nir_block *block)
          break;
       }
 
+      case nir_intrinsic_memory_barrier_buffer:
+      case nir_intrinsic_memory_barrier_atomic_counter:
+         clear_unused_for_modes(&unused_writes, nir_var_mem_ssbo);
+         break;
+
+      case nir_intrinsic_memory_barrier_shared:
+         clear_unused_for_modes(&unused_writes, nir_var_mem_shared);
+         break;
+
       case nir_intrinsic_scoped_memory_barrier: {
          if (nir_intrinsic_memory_semantics(intrin) & NIR_MEMORY_RELEASE) {
             clear_unused_for_modes(&unused_writes,