This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [autovect] [patch] Handle COMPONENT_REF and INDIRECT_REF bases in base_object_differ_p


Ira Rosen wrote:
> 
> This patch adds a support for COMPONENT_REF and INDIRECT_REF bases
> comparison in base_object_differ_p (e.g., a.b[] and (*p)[]). This case was
> not handled until now. Testcase attached.
> 
> For now, the function omega_dependence_tester was #if 0, since it exists
> for testing only and causes warnings in compilation.
> 

thanks, and sorry for this glitch.

> Bootstrapped and tested on ppc-darwin. Committed to autovect branch.
> 

Cool, thanks.

I have just a minor comment for the following code that seem to be
symetrical:

+   /* Compare a record/union access (b.c[i] or p->c[i]) and a pointer
+      ((*q)[i]).  */
+   if ((TREE_CODE (base_a) == INDIRECT_REF
+        && (TREE_CODE (base_b) == COMPONENT_REF
+            && ((TREE_CODE (TREE_OPERAND (base_b, 0)) == VAR_DECL
+               && (ptr_decl_may_alias_p (TREE_OPERAND (base_a, 0),
+                                         TREE_OPERAND (base_b, 0), a, &aliased)
+                   && !aliased))
+              || (TREE_CODE (TREE_OPERAND (base_b, 0)) == INDIRECT_REF
+                  && (ptr_ptr_may_alias_p (TREE_OPERAND (base_a, 0),
+                                           TREE_OPERAND (base_b, 0), a, b,
+                                           &aliased)
+                      && !aliased)))))
+        || (TREE_CODE (base_b) == INDIRECT_REF
+          && (TREE_CODE (base_a) == COMPONENT_REF
+              && ((TREE_CODE (TREE_OPERAND (base_a, 0)) == VAR_DECL
+                   && (ptr_decl_may_alias_p (TREE_OPERAND (base_b, 0),
+                                             TREE_OPERAND (base_a, 0), b,
+                                             &aliased)
+                       && !aliased))
+              || (TREE_CODE (TREE_OPERAND (base_a, 0)) == INDIRECT_REF
+                  && (ptr_ptr_may_alias_p (TREE_OPERAND (base_a, 0),
+                                           TREE_OPERAND (base_b, 0), a, b,
+                                           &aliased)
+                      && !aliased))))))
+

wouldn't it be more readable to encapsulate the logic in a static
function called compare_record_union_pointer_p (or something better)
and then just say:

if (compare_record_union_pointer_p (a, b, base_a, base_b, &aliased)
    || compare_record_union_pointer_p (a, b, base_b, base_a, &aliased))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]