This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [autovect] [patch] Handle COMPONENT_REF and INDIRECT_REF bases in base_object_differ_p
- From: Ira Rosen <IRAR at il dot ibm dot com>
- To: Sebastian Pop <sebastian dot pop at cri dot ensmp dot fr>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 7 Jun 2005 14:27:22 +0300
- Subject: Re: [autovect] [patch] Handle COMPONENT_REF and INDIRECT_REF bases in base_object_differ_p
Sebastian Pop <sebastian.pop@cri.ensmp.fr> wrote on 06/06/2005 16:21:38:
> 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.
Maybe I can remove this code?
>
> > 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))
>
Thanks, I am going to prepare a patch for this.
Ira