summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorBas Nieuwenhuizen <[email protected]>2019-01-17 19:54:20 +0100
committerBas Nieuwenhuizen <[email protected]>2019-01-18 00:55:35 +0100
commit8424cd8fbd1671c4c13f57cfa34bf8145d0fffcf (patch)
tree5ef2ee4fcc160b60706c46ebb7425168a1444b49 /src/compiler
parent927ba12b53c90ebd8a2c4e3806d1052e7d604ded (diff)
nir: Account for atomics in copy propagation.
Otherwise writes get propagated across atomics if no barrier is used. Without barrier writes should still be visible in the same invocation, so an atomic has to be considered a write. CC: <[email protected]> Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]> Fixes: b3c61469255 "nir: Copy propagation between blocks" Fixes: 62332d139c8 "nir: Add a local variable-based copy propagation pass"
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/nir/nir_opt_copy_prop_vars.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/compiler/nir/nir_opt_copy_prop_vars.c b/src/compiler/nir/nir_opt_copy_prop_vars.c
index 3dc0ad80573..8a5e1155082 100644
--- a/src/compiler/nir/nir_opt_copy_prop_vars.c
+++ b/src/compiler/nir/nir_opt_copy_prop_vars.c
@@ -157,9 +157,19 @@ gather_vars_written(struct copy_prop_var_state *state,
written->modes = nir_var_shader_out;
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:
case nir_intrinsic_store_deref:
case nir_intrinsic_copy_deref: {
- /* Destination in _both_ store_deref and copy_deref is src[0]. */
+ /* Destination in all of store_deref, copy_deref and the atomics is src[0]. */
nir_deref_instr *dst = nir_src_as_deref(intrin->src[0]);
uintptr_t mask = intrin->intrinsic == nir_intrinsic_store_deref ?
@@ -770,6 +780,19 @@ copy_prop_vars_block(struct copy_prop_var_state *state,
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:
+ kill_aliases(copies, nir_src_as_deref(intrin->src[0]), 0xf);
+ break;
+
default:
break;
}