Mesa (master): nir/copy_prop_vars: Get modes directly from derefs

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Dec 18 19:13:41 UTC 2018


Module: Mesa
Branch: master
Commit: fa40a58fd9c0faeead561fd1dbaaaefc6eb61633
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fa40a58fd9c0faeead561fd1dbaaaefc6eb61633

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Thu Dec 13 16:28:23 2018 -0600

nir/copy_prop_vars: Get modes directly from derefs

Instead of going all the way back to the variable, just look at the
deref.  The modes are guaranteed to be the same by nir_validate whenever
the variable can be found.  This fixes apply_barrier_for_modes for
derefs that don't have an accessible variable.

Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>

---

 src/compiler/nir/nir_opt_copy_prop_vars.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/compiler/nir/nir_opt_copy_prop_vars.c b/src/compiler/nir/nir_opt_copy_prop_vars.c
index 48070cd5e3..a540e01529 100644
--- a/src/compiler/nir/nir_opt_copy_prop_vars.c
+++ b/src/compiler/nir/nir_opt_copy_prop_vars.c
@@ -337,12 +337,8 @@ apply_barrier_for_modes(struct util_dynarray *copies,
                         nir_variable_mode modes)
 {
    util_dynarray_foreach_reverse(copies, struct copy_entry, iter) {
-      nir_variable *dst_var = nir_deref_instr_get_variable(iter->dst);
-      nir_variable *src_var = iter->src.is_ssa ? NULL :
-         nir_deref_instr_get_variable(iter->src.deref);
-
-      if ((dst_var->data.mode & modes) ||
-          (src_var && (src_var->data.mode & modes)))
+      if ((iter->dst->mode & modes) ||
+          (!iter->src.is_ssa && (iter->src.deref->mode & modes)))
          copy_entry_remove(copies, iter);
    }
 }




More information about the mesa-commit mailing list