This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Use OEP_ADDRESS_OF in emit-rtl.c
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Richard Biener <rguenther at suse dot de>
- Cc: Jan Hubicka <hubicka at ucw dot cz>, gcc-patches at gcc dot gnu dot org, law at redhat dot com
- Date: Wed, 7 Oct 2015 19:33:41 +0200
- Subject: Re: Use OEP_ADDRESS_OF in emit-rtl.c
- Authentication-results: sourceware.org; auth=none
- References: <20151007052926 dot GA5527 at kam dot mff dot cuni dot cz> <alpine dot LSU dot 2 dot 11 dot 1510071027440 dot 6516 at zhemvz dot fhfr dot qr>
>
> Did you audit all callers of mem_attrs_eq_p to see if they really
> only care about that? After all MEM_EXPR, via access paths, encode
> type-based alias info and thus replacing one with the other (cse.c use
> or ifcvt.c use) is only valid if that doesn't break dependences.
Hmm, expr is used by ao_ref_from_mem and nonoverlapping_memrefs_p.
The alias set of the access is not taken from expr, but from alias set info
stored in the memory attribute itself (and it is checked by those to match)
I still think it is an address of the expression that matters, not the value.
I think operand_equal_p may, for example, consider two different VAR_DECL equivalent
if their constructors are, because the value is (it doesn't do that), but their
addresses differ.
I will look more into nonoverlapping_memrefs_p and ao_ref_from_mem. The first
one may need some update to tree-alias infrastructure....
Honza
>
> So I don't believe this is safe.
>
> Thanks,
> Richard.
>
> > Honza
> >
> > * emit-rtl.c (mem_attrs_eq_p, mem_expr_equal_p): Pass OEP_ADDRESS_OF
> > to operand_equal_p.
> >
> > Index: emit-rtl.c
> > ===================================================================
> > --- emit-rtl.c (revision 228131)
> > +++ emit-rtl.c (working copy)
> > @@ -334,7 +334,7 @@ mem_attrs_eq_p (const struct mem_attrs *
> > && p->addrspace == q->addrspace
> > && (p->expr == q->expr
> > || (p->expr != NULL_TREE && q->expr != NULL_TREE
> > - && operand_equal_p (p->expr, q->expr, 0))));
> > + && operand_equal_p (p->expr, q->expr, OEP_ADDRESS_OF))));
> > }
> >
> > /* Set MEM's memory attributes so that they are the same as ATTRS. */
> > @@ -1657,7 +1657,7 @@ mem_expr_equal_p (const_tree expr1, cons
> > if (TREE_CODE (expr1) != TREE_CODE (expr2))
> > return 0;
> >
> > - return operand_equal_p (expr1, expr2, 0);
> > + return operand_equal_p (expr1, expr2, OEP_ADDRESS_OF);
> > }
> >
> > /* Return OFFSET if XEXP (MEM, 0) - OFFSET is known to be ALIGN
> >
> >
>
> --
> Richard Biener <rguenther@suse.de>
> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)