http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35561
--- Comment #10 from davidxl <xinliangli at gmail dot com> 2011-06-27 20:44:56 UTC --- Agree. Such optimization should not be done in gimplication, Nor should the const keyword be looked at. It should be done in middle end where local aggregate are analyzed: 1) the aggregate is only written once with constant initializer -- this implies that address of such aggregate is not escaped 2) all uses of the aggregate are dominated by the initialization statement 3) address of aggregate is not used comparison. David On Thu, Jun 23, 2011 at 6:31 AM, jakub at gcc dot gnu.org < gcc-bugzi...@gcc.gnu.org> wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35561 > > Jakub Jelinek <jakub at gcc dot gnu.org> changed: > > What |Removed |Added > > ---------------------------------------------------------------------------- > CC| |jakub at gcc dot gnu.org > > --- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-06-23 > 13:31:01 UTC --- > Well, we could still optimize it e.g. in leaf functions or in functions > that > only call leaf functions (__attribute__((leaf))). But we do this > transformation during gimplification, so either we'd need to add an > optimization that would turn an automatic aggregate into static aggregate > if > possible and useful later on (in particular, if it is determined to be > never > written into and its value doesn't escape current function or current > function > is leaf or only calls leaf functions and doesn't tail recurse), or we'd > need to > do some analysis right before gimplification starts to find out if a > function > must be leaf or only call leaf functions. > > -- > Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email > ------- You are receiving this mail because: ------- > You reported the bug. >