Mesa (staging/20.1): nir/deref: Don't try to compare derefs containing casts
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Aug 5 11:02:40 UTC 2020
Module: Mesa
Branch: staging/20.1
Commit: 72f3e348178e97b45d5477ee0c67f240fcf01a82
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=72f3e348178e97b45d5477ee0c67f240fcf01a82
Author: Jason Ekstrand <jason at jlekstrand.net>
Date: Fri Jul 24 20:27:37 2020 -0500
nir/deref: Don't try to compare derefs containing casts
One day, we may want copy_prop_vars or other passes to be able to see
through certain types of casts such as when someone casts a uint64_t to
a uvec2. However, for now we should just avoid casts all together.
Fixes: d8e3edb784d3a "nir/deref: Support casts and ptr_as_array in..."
Tested-by: Jesse Natalie <jenatali at microsoft.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6072>
(cherry picked from commit 611f654fcf715364b65ca690c0521c3e3038824f)
---
.pick_status.json | 2 +-
src/compiler/nir/nir_deref.c | 10 ++++++----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 55596f00c05..3a0ec1d059d 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -4,7 +4,7 @@
"description": "nir/deref: Don't try to compare derefs containing casts",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "d8e3edb784d3afb313420fc8d58b491a57fad9c1"
},
diff --git a/src/compiler/nir/nir_deref.c b/src/compiler/nir/nir_deref.c
index 65757fce16f..7a84ff781d7 100644
--- a/src/compiler/nir/nir_deref.c
+++ b/src/compiler/nir/nir_deref.c
@@ -505,8 +505,8 @@ nir_compare_deref_paths(nir_deref_path *a_path,
}
/* We're at either the tail or the divergence point between the two deref
- * paths. Look to see if either contains a ptr_as_array deref. It it
- * does we don't know how to safely make any inferences. Hopefully,
+ * paths. Look to see if either contains cast or a ptr_as_array deref. If
+ * it does we don't know how to safely make any inferences. Hopefully,
* nir_opt_deref will clean most of these up and we can start inferring
* things again.
*
@@ -516,11 +516,13 @@ nir_compare_deref_paths(nir_deref_path *a_path,
* different constant indices.
*/
for (nir_deref_instr **t_p = a_p; *t_p; t_p++) {
- if ((*t_p)->deref_type == nir_deref_type_ptr_as_array)
+ if ((*t_p)->deref_type == nir_deref_type_cast ||
+ (*t_p)->deref_type == nir_deref_type_ptr_as_array)
return nir_derefs_may_alias_bit;
}
for (nir_deref_instr **t_p = b_p; *t_p; t_p++) {
- if ((*t_p)->deref_type == nir_deref_type_ptr_as_array)
+ if ((*t_p)->deref_type == nir_deref_type_cast ||
+ (*t_p)->deref_type == nir_deref_type_ptr_as_array)
return nir_derefs_may_alias_bit;
}
More information about the mesa-commit
mailing list