The function in question should ignore ADDR_EXPRs that appear inside CALL_EXPR parameter lists so that we, for typedef struct { int i; int j; int k; } Foo; void bar(Foo*); void foo(void) { Foo a; a.i = 1; bar(&a); } do not create SFTs for all elements of a, but only for the first. This will reduce clobbers at call sites from <bb 2>: # SFT.2_2 = V_MUST_DEF <SFT.2_1>; a.i = 1; # SFT.0_5 = V_MAY_DEF <SFT.0_3>; # SFT.1_6 = V_MAY_DEF <SFT.1_4>; # SFT.2_7 = V_MAY_DEF <SFT.2_2>; bar (&a); to <bb 2>: # SFT.2_2 = V_MUST_DEF <SFT.2_1>; a.i = 1; # SFT.2_7 = V_MAY_DEF <SFT.2_2>; bar (&a); it especially would reduce the amounts of SFTs we generate for gfortran struct st_parm, which usually only gets a few fields written to and then it's address is passed to a function.
Really for this example: For this case V_MAY_DEF's are dead anyways at least for the other SFT's besides the one for a.i. Try thinking what about: typedef struct { int i; int j; int k; } Foo; void bar(Foo*); void bar1(Foo); void foo(void) { Foo a; a.i = 1; bar(&a); bar1(a); }
I get <bb 2>: # SFT.0D.1534_2 = V_MUST_DEF <SFT.0D.1534_1>; aD.1532.iD.1521 = 1; # SFT.0D.1534_3 = V_MAY_DEF <SFT.0D.1534_2>; bar (&aD.1532); # SFT.0D.1534_4 = V_MAY_DEF <SFT.0D.1534_3>; bar2 (aD.1532); for this case.
Patch posted, but now stdarg-5.c ICEs.
ICE is because of PR26439
Subject: Bug number PR26421 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-02/msg01803.html
updated patch was posted.
Subject: Bug 26421 Author: rguenth Date: Sun Feb 26 21:02:43 2006 New Revision: 111461 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=111461 Log: 2006-02-26 Richard Guenther <rguenther@suse.de> PR tree-optimization/26421 * tree-ssa-alias.c (find_used_portions): Don't treat parameters in function calls that are ADDR_EXPRs as using the whole structure. * gcc.dg/tree-ssa/pr26421.c: New testcase. Added: trunk/gcc/testsuite/gcc.dg/tree-ssa/pr26421.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-ssa-alias.c
Fixed.
This testcase fails on the mainline.
It will stop failing once I revert my bandaid fix, but I'll just fix the testcase.