[Mesa-dev] [PATCH] nir/derefs: Add a nir_derefs_do_not_alias enum value
Jason Ekstrand
jason at jlekstrand.net
Mon Nov 19 18:32:55 UTC 2018
This makes some of the code more clear.
---
src/compiler/nir/nir_deref.c | 8 ++++----
src/compiler/nir/nir_deref.h | 1 +
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/compiler/nir/nir_deref.c b/src/compiler/nir/nir_deref.c
index 59b36a7f255..68a3aad5c70 100644
--- a/src/compiler/nir/nir_deref.c
+++ b/src/compiler/nir/nir_deref.c
@@ -289,7 +289,7 @@ nir_compare_deref_paths(nir_deref_path *a_path,
nir_deref_path *b_path)
{
if (!modes_may_alias(b_path->path[0]->mode, a_path->path[0]->mode))
- return 0;
+ return nir_derefs_do_not_alias;
if (a_path->path[0]->deref_type != b_path->path[0]->deref_type)
return nir_derefs_may_alias_bit;
@@ -299,7 +299,7 @@ nir_compare_deref_paths(nir_deref_path *a_path,
* they're not the same variable, we know they can't possibly alias.
*/
if (a_path->path[0]->var != b_path->path[0]->var)
- return 0;
+ return nir_derefs_do_not_alias;
} else {
assert(a_path->path[0]->deref_type == nir_deref_type_cast);
/* If they're not exactly the same cast, we can't compare them so we
@@ -357,7 +357,7 @@ nir_compare_deref_paths(nir_deref_path *a_path,
*/
if (nir_src_as_uint(a_tail->arr.index) !=
nir_src_as_uint(b_tail->arr.index))
- return 0;
+ return nir_derefs_do_not_alias;
} else if (a_tail->arr.index.ssa == b_tail->arr.index.ssa) {
/* They're the same indirect, continue on */
} else {
@@ -373,7 +373,7 @@ nir_compare_deref_paths(nir_deref_path *a_path,
case nir_deref_type_struct: {
/* If they're different struct members, they don't even alias */
if (a_tail->strct.index != b_tail->strct.index)
- return 0;
+ return nir_derefs_do_not_alias;
break;
}
diff --git a/src/compiler/nir/nir_deref.h b/src/compiler/nir/nir_deref.h
index c61c3f9366f..20d40377e6e 100644
--- a/src/compiler/nir/nir_deref.h
+++ b/src/compiler/nir/nir_deref.h
@@ -55,6 +55,7 @@ nir_ssa_def *nir_build_deref_offset(nir_builder *b, nir_deref_instr *deref,
glsl_type_size_align_func size_align);
typedef enum {
+ nir_derefs_do_not_alias = 0,
nir_derefs_equal_bit = (1 << 0),
nir_derefs_may_alias_bit = (1 << 1),
nir_derefs_a_contains_b_bit = (1 << 2),
--
2.19.1
More information about the mesa-dev
mailing list