This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] fix opt/13798
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Joern Rennecke <joern dot rennecke at superh dot com>
- Cc: Richard Henderson <rth at redhat dot com>,Dale Johannesen <dalej at apple dot com>, rth at atrey dot karlin dot mff dot cuni dot cz,gcc-patches at gcc dot gnu dot org, Jan Hubicka <hubicka at ucw dot cz>
- Date: Wed, 28 Jan 2004 23:28:08 +0100
- Subject: Re: [tree-ssa] fix opt/13798
- References: <20040128221321.GC3217@redhat.com> <200401282223.i0SMNmJ31297@linsvr1.uk.superh.com>
> > > @@ -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