nir/copy_prop_vars: Re-order some logic in compare_derefs
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 28 Mar 2018 00:21:35 +0000 (17:21 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sat, 23 Jun 2018 03:54:00 +0000 (20:54 -0700)
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/compiler/nir/nir_opt_copy_prop_vars.c

index 2e1a2e0cd68b3931af5a2d8478b0f13de12910e8..bf3b7933100c1c36230a699d6c3adeb571a4d613 100644 (file)
@@ -151,19 +151,19 @@ compare_derefs(nir_deref_var *a, nir_deref_var *b)
          nir_deref_array *a_arr = nir_deref_as_array(a_tail);
          nir_deref_array *b_arr = nir_deref_as_array(b_tail);
 
-         if (a_arr->deref_array_type == nir_deref_array_type_direct &&
-             b_arr->deref_array_type == nir_deref_array_type_direct) {
-            /* If they're both direct and have different offsets, they
-             * don't even alias much less anything else.
-             */
-            if (a_arr->base_offset != b_arr->base_offset)
-               return 0;
-         } else if (a_arr->deref_array_type == nir_deref_array_type_wildcard) {
+         if (a_arr->deref_array_type == nir_deref_array_type_wildcard) {
             if (b_arr->deref_array_type != nir_deref_array_type_wildcard)
                result &= ~derefs_b_contains_a_bit;
          } else if (b_arr->deref_array_type == nir_deref_array_type_wildcard) {
             if (a_arr->deref_array_type != nir_deref_array_type_wildcard)
                result &= ~derefs_a_contains_b_bit;
+         } else if (a_arr->deref_array_type == nir_deref_array_type_direct &&
+                    b_arr->deref_array_type == nir_deref_array_type_direct) {
+            /* If they're both direct and have different offsets, they
+             * don't even alias much less anything else.
+             */
+            if (a_arr->base_offset != b_arr->base_offset)
+               return 0;
          } else if (a_arr->deref_array_type == nir_deref_array_type_indirect &&
                     b_arr->deref_array_type == nir_deref_array_type_indirect) {
             assert(a_arr->indirect.is_ssa && b_arr->indirect.is_ssa);