Use OEP_ADDRESS_OF in emit-rtl.c

Jan Hubicka hubicka@ucw.cz
Sat Oct 10 20:36:00 GMT 2015


> > Hmm, I see.  I wonder how complex the expressions are and if we can't simply
> > compare AO properties of MEM_REF at toplevel and then dispatch to
> > operand_equal_p (..., OEP_ADDRESS_OF)
> > which would make more sense to me.
> 
> I can't see how we can do that comparison conservatively without resorting
> to exact equality.  The reason is that the two MEM_EXPRs e1 and e2 have
> to behave equal TBAA-wise when compared against arbitrary e3.  We

This is not very different from what we do at gimple level i.e. in tail merging,
ipa-icf or load/store motion.  Maybe we want something like OEP_ALIAS or OEP_STRUCTURAL
flag to control this...

> can be sure this is the case if e1 and e2 have alias-set zero or if
> they are structurally equivalent.  But that's all I think.
> 
> > I would basically expect decls and mem_refs here.  Reason why I started 
> > to look into that is that I added sanity check that operand_equal_p 
> > (...,0) is not called on things that do not have value (function types 
> > and incomplete types) and this is one of places that fires.
> 
> MEM_EXPR can be arbitrarily complex (including array-refs with
> variable index SSA name use for example).
> 
> > > 
> > > > I will look more into nonoverlapping_memrefs_p and ao_ref_from_mem. The first
> > > > one may need some update to tree-alias infrastructure....
> > > 
> > > I'd rather remove it completely (at least that was my plan eventually).
> > > rtx_refs_may_alias_p is supposed to handle everything it handles.
> > 
> > Yep, that was my feeling from looking into that yesterday....
> 
> So the experiment to carry out is (same for all other callers)
> 
> Index: gcc/alias.c
> ===================================================================
> --- gcc/alias.c (revision 228597)
> +++ gcc/alias.c (working copy)
> @@ -2710,10 +2710,10 @@ true_dependence_1 (const_rtx mem, machin
>    if (mems_in_disjoint_alias_sets_p (x, mem))
>      return 0;
>  
> -  if (nonoverlapping_memrefs_p (mem, x, false))
> -    return 0;
> -
> -  return rtx_refs_may_alias_p (x, mem, true);
> +  int tem = rtx_refs_may_alias_p (x, mem, true);
> +  if (tem)
> +    gcc_assert (!nonoverlapping_memrefs_p (mem, x, false));
> +  return tem;
>  }
>  
>  /* True dependence: X is read after store in MEM takes place.  */
> 
> and analyze what fires (or hope nothing does).

OK, will give it a try...
Honza
> 
> Richard.
> 
> > Honza
> > 
> > 
> 
> -- 
> Richard Biener <rguenther@suse.de>
> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)



More information about the Gcc-patches mailing list