This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR optimization/12324
- From: Jan Hubicka <jh at suse dot cz>
- To: "Joseph S. Myers" <jsm at polyomino dot org dot uk>
- Cc: Bernardo Innocenti <bernie at develer dot com>,Jan Hubicka <hubicka at ucw dot cz>, Jan Hubicka <jh at suse dot cz>,gcc-patches at gcc dot gnu dot org, rth at redhat dot com
- Date: Mon, 6 Oct 2003 11:30:42 +0200
- Subject: Re: [PATCH] PR optimization/12324
- References: <20030927135507.GG23075@kam.mff.cuni.cz> <Pine.LNX.4.58.0309271654050.21283@kern.srcf.societies.cam.ac.uk> <20030927183054.GA25269@atrey.karlin.mff.cuni.cz> <3F7D2FEC.5040200@develer.com> <Pine.LNX.4.58.0310032155370.17439@kern.srcf.societies.cam.ac.uk>
> On Fri, 3 Oct 2003, Bernardo Innocenti wrote:
>
> > (const phy_cmd_t []) { /* config */
>
> So here the initializer is a pointer to a compound literal - and that
> compound literal would naturally get written out exactly once (in the
> absence of being deferred). The problem case which I think is why Jakub
> made them deferred is if the initializer is a compound literal of
> structure - not array - type (permitted as an extension in gnu89 mode),
> where it gets included in the larger initializer and shouldn't get emitted
> on its own as well.
Now I see. So all we need is dead function ellimination. There is
testcase in testsuite for this too and didn't break with my previous
patch. The patch however makes the initializer to be output when not
optimizing that is wrong I guess. does the attached patch look OK?
Mon Oct 6 11:10:36 CEST 2003 Jan Hubicka <jh@suse.cz>
PR opt/12324
* c-decl.c (build_compound_literal): Set DECL_DEFER_OUTPUT only when not
doing unit-at-a-time.
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.454
diff -c -3 -p -r1.454 c-decl.c
*** c-decl.c 4 Oct 2003 16:49:26 -0000 1.454
--- c-decl.c 6 Oct 2003 09:10:19 -0000
*************** build_compound_literal (tree type, tree
*** 3088,3094 ****
compound_literal_number);
compound_literal_number++;
DECL_NAME (decl) = get_identifier (name);
! DECL_DEFER_OUTPUT (decl) = 1;
DECL_COMDAT (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
pushdecl (decl);
--- 3088,3098 ----
compound_literal_number);
compound_literal_number++;
DECL_NAME (decl) = get_identifier (name);
!
! /* We need the unused static initializers to be elliminated. These may
! be created using GNU extensions. */
! if (!flag_unit_at_a_time)
! DECL_DEFER_OUTPUT (decl) = 1;
DECL_COMDAT (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
pushdecl (decl);