This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: add inheritance support to nonoverlapping_component_refs_p
Richard Henderson <rth@redhat.com> writes:
> On Wed, May 29, 2002 at 04:24:43PM -0700, Dan Nicolaescu wrote:
> > Another failing test, global pointer vars that point to objects that
> > have "char" fields are put in alias set 0 (this might be OK though).
>
> I wouldn't expect alias sets to have anything to do with this.
> In fact, all these tests should be run at -O1 so that we don't
> use alias sets.
>
> We're trying to test alias resolution based on location within
> a larger object, not whether types of the accessed objects differ.
I'll look into it. The testcase works if compiled with -O1 -Dchar=int,
that's why I suspected is something about alias set 0.
Also please look at this debugging session:
Breakpoint 5, nonoverlapping_memrefs_p (x=0x32d000, y=0x3fe600)
at ../../gcc/gcc/alias.c:2003
2003 tree exprx = MEM_EXPR (x), expry = MEM_EXPR (y);
2002 {
(gdb) n
2003 tree exprx = MEM_EXPR (x), expry = MEM_EXPR (y);
(gdb) n
2010 if (exprx == 0 || expry == 0)
(gdb) p x
$14 = 0x3fe6d8
(gdb) pr
(mem/s/j:SI (plus:SI (reg/f:SI 107)
(const_int 8 [0x8])) [0 <variable>.f1+0 S4 A64])
^^^^^^^^
the variable is lost here...
(gdb) p y
$15 = 0x3fe600
(gdb) pr
(mem/f:SI (lo_sum:SI (reg/f:SI 109)
(symbol_ref:SI ("gs1"))) [0 gs1+0 S4 A32])
I'll have to dig more.
> > /* Expected to fail, GCC doesn't know yet that the 2 params can't
> > overlap */
>
> That's shouldn't be true at all. Even failing the struct test, gcc
> should know that PARMF is at SP+N and PARMS is at SP+M where M > N.
It's not true on x86, but it's true on SPARC with those small
structures....
Breakpoint 6, nonoverlapping_memrefs_p (x=0x2, y=0x3fc0d8)
at ../../gcc/gcc/alias.c:2003
2003 tree exprx = MEM_EXPR (x), expry = MEM_EXPR (y);
2002 {
(gdb) p x
$73 = 0x3fc150
(gdb) pr
(mem/s/j:QI (reg/v/f:SI 108) [0 parms.f2+0 S1 A16])
(gdb) p y
$74 = 0x3fc0d8
(gdb) pr
(mem/s/j:QI (plus:SI (reg/v/f:SI 107)
(const_int 8 [0x8])) [0 parmf.f1+0 S1 A64])
and the 107 and 108 pseudos are:
(insn 4 2 6 (set (reg/v/f:SI 107)
(reg:SI 24 %i0)) -1 (nil)
(expr_list:REG_EQUIV (mem/s:SI (reg/f:SI 102 virtual-incoming-args) [0 parmf
+0 S16 A64])
(nil)))
(insn 6 4 7 (set (reg/v/f:SI 108)
(reg:SI 25 %i1)) -1 (nil)
(expr_list:REG_EQUIV (mem/s:SI (plus:SI (reg/f:SI 102 virtual-incoming-args)
(const_int 4 [0x4])) [0 parms+0 S4 A16])
(nil)))
At least in this case testing for PARM_DECL as below should help.
> > I have a fix (that I am still testing) for the last one, it adds
> >
> > declx = TREE_OPERAND (x, 0);
> > decly = TREE_OPERAND (y, 0);
> > if (declx && decly && DECL_P (declx) && DECL_P (decly)
> > && (TREE_CODE (declx) == PARM_DECL)
> > && (TREE_CODE (decly) == PARM_DECL)
> > && declx != decly)
> > return 1;
> >
> > to the beginning of nonoverlapping_component_refs_p
>
> This is the wrong place to test this.
Is nonoverlapping_memrefs_p better?
> > In general params passed by value do not overlap to each other, global
> > and local vars, right?
>
> If they're really passed by value, yes. But some ABIs pass
> by invisible reference.
Is there a way to test for that?