[Mesa-dev] [PATCH] nir/derefs: Add a nir_derefs_do_not_alias enum value
Jason Ekstrand
jason at jlekstrand.net
Tue Nov 20 14:30:49 UTC 2018
It's based on the "support casts in comparisons" patch but they're easy
enough to reorder.
On November 20, 2018 02:07:59 Thomas Helland <thomashelland90 at gmail.com> wrote:
> It seems this patch is not based on current master?
> However, it is trivial enough and I like the change,
> so with a rebase on current master this patch is:
>
> Reviewed-by: Thomas Helland <thomashelland90 at gmail.com>
>
> Den man. 19. nov. 2018 kl. 19:33 skrev Jason Ekstrand <jason at jlekstrand.net>:
>>
>> 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
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list