This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Redundant malloc in structure optimization? (testsuite/gcc.dg/struct/wo_prof_global_var.c)
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Olga Golovanevsky" <OLGA at il dot ibm dot com>
- Cc: "Bingfeng Mei" <bmei at broadcom dot com>, gcc at gcc dot gnu dot org, "Kenneth Zadeck" <zadeck at naturalbridge dot com>
- Date: Thu, 1 May 2008 15:00:44 +0200
- Subject: Re: Redundant malloc in structure optimization? (testsuite/gcc.dg/struct/wo_prof_global_var.c)
- References: <2E073B3ABB3F664DBA1D1C4D5FB47EF40CD3A801@NT-IRVA-0752.brcm.ad.broadcom.com> <OF743D96E8.C1720DE9-ONC225743C.00426FB1-C225743C.0043AC66@il.ibm.com>
On Thu, May 1, 2008 at 2:19 PM, Olga Golovanevsky <OLGA@il.ibm.com> wrote:
>
>
> gcc-owner@gcc.gnu.org wrote on 28/04/2008 12:36:44:
>
>
> > Hello,
> > I am looking at a testsuite failure (wo_prof_global_var.c) in my
> > porting. Somehow, I found GCC 4.3.0 seems to generate unnecessary malloc
> > during structure optimization. In the code, the structure is split into
> > two individual fields (D.2240 and D.2242) and they are allocated
> > separately. But the original structure (D.2215) is still allocated, and
> > not used afterward. The following RTL-level optimization cannot
> > eliminate it.
>
> I think that p is global, and in my understanding right now we have no
> whole
> program dead code elimination optimization in gcc, but may be I am wrong.
You cannot remove p, but if you could split up the allocation for *p then you
can for sure remove the original allocation for *p. Otherwise you generated
wrong code in the first place, which you certainly did, if p was global.
Richard.