> > +  bool in_symtab1 = decl_in_symtab_p (base1);
> > +  bool in_symtab2 = decl_in_symtab_p (base2);
> > +
> > +  /* Declarations of non-automatic variables may have aliases.  All other
> > +     decls are unique.  */
> > +  if (in_symtab1 != in_symtab2 || !in_symtab1)
> > +    return 0;
> > +  ret = symtab_node::get_create (base1)->equal_address_to
> > +            (symtab_node::get_create (base2), true);
> 
> And I don't like ::get_create too much, why's ::get not enough here?
> Predicates really shouldn't end up changing global state.

I will re-test with ::get here.  I think I only copied the code from folding.
One case we can get decls w/o corresponding symbol table entries during late
compilation is when we introduce a new builtin call.  We may just revisit
all those place and be sure we inser that to symbol table, but that is for next
stage1.

> 
> please refactor to avoid doing this twice WRT !x_decl / !y_decl
> 
> Ok with these changes.

Thanks!
I think I also need to update IPA-PTA code to work on alias targets same way as
I did for ipa-reference (need to construct a testcase) and we sould be down to
missed optimizations and not wrongcodes with extra aliases
(GVN/CSE/operand_equal_p should know about aliases to make them completely
no-op)

Honza
> 
> Thanks,
> Richard.
> 
> > +      /* If decls are different or we know by offsets that there is no 
> > overlap,
> > +    we win.  */
> > +      if (!cmp || !offset_overlap_p (c, xsize, ysize))
> > +   return 0;
> > +      /* Decls may or may not be different and offsets overlap....*/
> > +      return -1;
> > +    }
> > +  else if (rtx_equal_for_memref_p (x, y))
> >      {
> >        return offset_overlap_p (c, xsize, ysize);
> >      }
> >  
> >    /* This code used to check for conflicts involving stack references and
> >       globals but the base address alias code now handles these cases.  */
> >  
> > @@ -2636,7 +2703,7 @@ nonoverlapping_memrefs_p (const_rtx x, c
> >       are constants or if one is a constant and the other a pointer into the
> >       stack frame.  Otherwise a different base means we can't tell if they
> >       overlap or not.  */
> > -  if (! rtx_equal_p (basex, basey))
> > +  if (! compare_base_decls (exprx, expry))
> >      return ((CONSTANT_P (basex) && CONSTANT_P (basey))
> >         || (CONSTANT_P (basex) && REG_P (basey)
> >             && REGNO_PTR_FRAME_P (REGNO (basey)))
> > @@ -2647,6 +2714,10 @@ nonoverlapping_memrefs_p (const_rtx x, c
> >    if (loop_invariant)
> >      return 0;              
> >  
> > +  /* Offset based disambiguation is OK even if we do not know that the
> > +     declarations are necessarily different
> > +    (i.e. compare_base_decls (exprx, expry) == 2)  */
> > +
> >    sizex = (!MEM_P (rtlx) ? (int) GET_MODE_SIZE (GET_MODE (rtlx))
> >        : MEM_SIZE_KNOWN_P (rtlx) ? MEM_SIZE (rtlx)
> >        : -1);
> > Index: alias.h
> > ===================================================================
> > --- alias.h (revision 231438)
> > +++ alias.h (working copy)
> > @@ -36,6 +36,7 @@ extern int nonoverlapping_memrefs_p (con
> >  extern void dump_alias_stats_in_alias_c (FILE *s);
> >  tree reference_alias_ptr_type (tree);
> >  bool alias_ptr_types_compatible_p (tree, tree);
> > +int compare_base_decls (tree, tree);
> >  
> >  /* This alias set can be used to force a memory to conflict with all
> >     other memories, creating a barrier across which no memory reference
> > 
> > 
> 
> -- 
> Richard Biener <rguent...@suse.de>
> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 
> 21284 (AG Nuernberg)

Reply via email to