This test has regressed. Executing on host: /home/dave/gnu/gcc-4.3/objdir/gcc/xgcc -B/home/dave/gnu/gcc-4 .3/objdir/gcc/ /home/dave/gnu/gcc-4.3/gcc/gcc/testsuite/gcc.dg/tree-ssa/pr26421. c -O2 -fdump-tree-alias1-vops -fno-show-column -S -o pr26421.s (timeout = 300) PASS: gcc.dg/tree-ssa/pr26421.c (test for excess errors) FAIL: gcc.dg/tree-ssa/pr26421.c scan-tree-dump-times V_MAY_DEF 1
I think it's ok again, but it shows one weakness of the current NONLOCAL scheme: foo () { struct Foo a; int D.1534; <bb 2>: # SFT.0_2 = V_MUST_DEF <SFT.0_1>; a.i = 1; # SFT.0_6 = V_MAY_DEF <SFT.0_2>; # NONLOCAL.6_7 = V_MAY_DEF <NONLOCAL.6_5>; bar (&a); # VUSE <SFT.0_6>; D.1534_3 = a.i; return D.1534_3; } we should see that &a points to a and so no NONLOCAL var is necessary here.
Adding p = &a and using that produces foo () { struct Foo * p; struct Foo a; int D.1535; <bb 2>: # SFT.2_2 = V_MUST_DEF <SFT.2_1>; a.i = 1; p_3 = &a; # SFT.0_9 = V_MAY_DEF <SFT.0_6>; # SFT.1_10 = V_MAY_DEF <SFT.1_7>; # SFT.2_11 = V_MAY_DEF <SFT.2_2>; # NONLOCAL.8_12 = V_MAY_DEF <NONLOCAL.8_8>; bar (p_3); # VUSE <SFT.2_11>; D.1535_4 = a.i; return D.1535_4; } !?
http://gcc.gnu.org/ml/gcc-cvs/2006-10/msg00625.html That just needs to merged back.
Subject: Re: FAIL: gcc.dg/tree-ssa/pr26421.c scan-tree-dump-times V_MAY_DEF 1 On 22 Oct 2006 17:16:00 -0000, rguenth at gcc dot gnu dot org <gcc-bugzilla@gcc.gnu.org> wrote: > > > ------- Comment #2 from rguenth at gcc dot gnu dot org 2006-10-22 17:16 ------- > Adding > p = &a > and using that produces > > foo () > { > struct Foo * p; > struct Foo a; > int D.1535; > > <bb 2>: > # SFT.2_2 = V_MUST_DEF <SFT.2_1>; > a.i = 1; > p_3 = &a; > # SFT.0_9 = V_MAY_DEF <SFT.0_6>; > # SFT.1_10 = V_MAY_DEF <SFT.1_7>; > # SFT.2_11 = V_MAY_DEF <SFT.2_2>; > # NONLOCAL.8_12 = V_MAY_DEF <NONLOCAL.8_8>; > bar (p_3); > # VUSE <SFT.2_11>; > D.1535_4 = a.i; > return D.1535_4; > > } > > !? Escaping computation is a bit funky, but this is correct.
(In reply to comment #1) > I think it's ok again, but it shows one weakness of the current NONLOCAL > scheme: > > foo () > { > struct Foo a; > int D.1534; > > <bb 2>: > # SFT.0_2 = V_MUST_DEF <SFT.0_1>; > a.i = 1; > # SFT.0_6 = V_MAY_DEF <SFT.0_2>; > # NONLOCAL.6_7 = V_MAY_DEF <NONLOCAL.6_5>; > bar (&a); > # VUSE <SFT.0_6>; > D.1534_3 = a.i; > return D.1534_3; > > } > > we should see that &a points to a and so no NONLOCAL var is necessary > here. > The nonlocal variable is not necessary because it is unused elsewhere, *not* because you only pass something pointing to a. If we had globals here, they could still be modified by the call to bar.
Is this still valid?
Fixed by: 2006-12-11 Aldy Hernandez <aldyh@redhat.com> Diego Novillo <dnovillo@redhat.com> * gcc.dg/tree-ssa/pr26421.c: Likewise