This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Improve memrefs_conflict_p with VALUEs
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 16 Apr 2010 07:49:54 -0700
- Subject: Re: [PATCH] Improve memrefs_conflict_p with VALUEs
- References: <20100416071843.GI2817@tyan-ft48-01.lab.bos.redhat.com>
On Fri, Apr 16, 2010 at 12:18 AM, Jakub Jelinek <jakub@redhat.com> wrote:
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2010-04-16 ?Jakub Jelinek ?<jakub@redhat.com>
>
> ? ? ? ?* alias.c (memrefs_conflict_p): If x and y are the same VALUE,
> ? ? ? ?don't call get_addr on both. ?If one expression is a VALUE and
> ? ? ? ?the other a REG, check VALUE's locs if the REG isn't among them.
>
> --- gcc/alias.c.jj ? ? ?2010-04-07 16:19:53.000000000 +0200
> +++ gcc/alias.c 2010-04-15 20:00:34.000000000 +0200
> @@ -1789,9 +1789,39 @@ static int
> ?memrefs_conflict_p (int xsize, rtx x, int ysize, rtx y, HOST_WIDE_INT c)
> ?{
> ? if (GET_CODE (x) == VALUE)
> - ? ?x = get_addr (x);
> + ? ?{
> + ? ? ?if (REG_P (y))
> + ? ? ? {
> + ? ? ? ? struct elt_loc_list *l;
> + ? ? ? ? for (l = CSELIB_VAL_PTR (x)->locs; l; l = l->next)
> + ? ? ? ? ? if (REG_P (l->loc) && rtx_equal_for_memref_p (l->loc, y))
> + ? ? ? ? ? ? break;
> + ? ? ? ? if (l)
> + ? ? ? ? ? x = y;
> + ? ? ? ? else
> + ? ? ? ? ? x = get_addr (x);
> + ? ? ? }
> + ? ? ?/* Don't call get_addr if y is the same VALUE. ?*/
> + ? ? ?else if (x != y)
> + ? ? ? x = get_addr (x);
> + ? ?}
> ? if (GET_CODE (y) == VALUE)
> - ? ?y = get_addr (y);
> + ? ?{
> + ? ? ?if (REG_P (x))
> + ? ? ? {
> + ? ? ? ? struct elt_loc_list *l;
> + ? ? ? ? for (l = CSELIB_VAL_PTR (y)->locs; l; l = l->next)
> + ? ? ? ? ? if (REG_P (l->loc) && rtx_equal_for_memref_p (l->loc, x))
> + ? ? ? ? ? ? break;
> + ? ? ? ? if (l)
> + ? ? ? ? ? y = x;
> + ? ? ? ? else
> + ? ? ? ? ? y = get_addr (y);
> + ? ? ? }
> + ? ? ?/* Don't call get_addr if x is the same VALUE. ?*/
> + ? ? ?else if (y != x)
> + ? ? ? y = get_addr (y);
> + ? ?}
Can you make a small function out of it and call it instead of duplicating
the whole thing?
--
H.J.