Mesa (master): nir/copy_prop_vars: Ignore volatile accesses
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jun 19 12:19:10 UTC 2019
Module: Mesa
Branch: master
Commit: 75063fbac522bcbc2e009c292d666e5aadc2d1f1
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=75063fbac522bcbc2e009c292d666e5aadc2d1f1
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Wed Jun 5 10:23:00 2019 +0200
nir/copy_prop_vars: Ignore volatile accesses
The spec explicitly says that volatile writes can't be removed and
volatile reads do not guarantee that the same value will still be around
after the read, as if there were a barrier after each read/write. Just
ignore them.
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
---
src/compiler/nir/nir_opt_copy_prop_vars.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/compiler/nir/nir_opt_copy_prop_vars.c b/src/compiler/nir/nir_opt_copy_prop_vars.c
index 0fd96b7bee8..a1c8ffabf7a 100644
--- a/src/compiler/nir/nir_opt_copy_prop_vars.c
+++ b/src/compiler/nir/nir_opt_copy_prop_vars.c
@@ -812,6 +812,9 @@ copy_prop_vars_block(struct copy_prop_var_state *state,
case nir_intrinsic_load_deref: {
if (debug) dump_instr(instr);
+ if (nir_intrinsic_access(intrin) & ACCESS_VOLATILE)
+ break;
+
nir_deref_instr *src = nir_src_as_deref(intrin->src[0]);
/* Direct array_derefs of vectors operate on the vectors (the parent
@@ -892,6 +895,9 @@ copy_prop_vars_block(struct copy_prop_var_state *state,
case nir_intrinsic_store_deref: {
if (debug) dump_instr(instr);
+ if (nir_intrinsic_access(intrin) & ACCESS_VOLATILE)
+ break;
+
nir_deref_instr *dst = nir_src_as_deref(intrin->src[0]);
assert(glsl_type_is_vector_or_scalar(dst->type));
@@ -936,6 +942,10 @@ copy_prop_vars_block(struct copy_prop_var_state *state,
case nir_intrinsic_copy_deref: {
if (debug) dump_instr(instr);
+ if ((nir_intrinsic_src_access(intrin) & ACCESS_VOLATILE) ||
+ (nir_intrinsic_dst_access(intrin) & ACCESS_VOLATILE))
+ break;
+
nir_deref_instr *dst = nir_src_as_deref(intrin->src[0]);
nir_deref_instr *src = nir_src_as_deref(intrin->src[1]);
@@ -1005,6 +1015,9 @@ copy_prop_vars_block(struct copy_prop_var_state *state,
case nir_intrinsic_deref_atomic_comp_swap:
if (debug) dump_instr(instr);
+ if (nir_intrinsic_access(intrin) & ACCESS_VOLATILE)
+ break;
+
nir_deref_instr *dst = nir_src_as_deref(intrin->src[0]);
unsigned num_components = glsl_get_vector_elements(dst->type);
unsigned full_mask = (1 << num_components) - 1;
More information about the mesa-commit
mailing list