This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-ssa] fix opt/13798


> > > @@ -1945,10 +1971,21 @@ nonoverlapping_memrefs_p (x, y)
> > >    tree exprx = MEM_EXPR (x), expry = MEM_EXPR (y);
> > >    rtx rtlx, rtly;
> > >    rtx basex, basey;
> > >    rtx moffsetx, moffsety;
> > >    HOST_WIDE_INT offsetx = 0, offsety = 0, sizex, sizey, tem;
> > > +
> > > +  if (exprx != expry
> > > +      && (non_addressed_function_scope_var (exprx) !=
> > > +	  non_addressed_function_scope_var (expry))
> > > +      /* (mem:BLK (const_int 0 [0x0]) [0 A8]) is used as a wildcard,
> > > +         when scan_loop detects that there is a non-pure function call -
> > > +         which might cause recursion.  */
> > > +      && XEXP (x, 0) != const0_rtx
> > > +      && XEXP (y, 0) != const0_rtx)
> > > +
> > > +    return 1;
> > 
> > What are you supposed to be proving here?  What's special about
> > function-scope?
> 
> If the address is also not taken in this function, it means that the address
> is not taken anywhere.  Hence, all accesses of this variable can be
> identified positively, and if the other memory access is something unknown
> (e.g. a pointer dereference which was an array access in the source, but
>  had to have the address computed into a register first because of limited
>  offset ranges and addessing modes), it can't alias.

Consider two inline copies of the same function sharing same static
variable where we optimized out the address taking operand in one but
fialed to do so in the other.

This is why I think the function scopeness is quite useless especially
when we can determine this globally using cgraph datastructures.

Honza


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]