public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/39672]  New: Local statics not promoted to const
@ 2009-04-07 11:14 rguenth at gcc dot gnu dot org
  2009-04-07 11:44 ` [Bug tree-optimization/39672] " hubicka at ucw dot cz
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-07 11:14 UTC (permalink / raw)
  To: gcc-bugs

For

int foo(void)
{
  static int blah = 1;
  return blah;
}

we should be able to promote blah to TREE_READONLY during ipa-reference (or
local analysis) if blah does not have its address taken and is not written
to in the function body.

This occurs for example in 189.lucas via

        real(kind=r16), save :: mt,one=1,two=2,one_fourth,pi,theta,theta2

note the save attribute.


-- 
           Summary: Local statics not promoted to const
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39672


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/39672] Local statics not promoted to const
  2009-04-07 11:14 [Bug tree-optimization/39672] New: Local statics not promoted to const rguenth at gcc dot gnu dot org
@ 2009-04-07 11:44 ` hubicka at ucw dot cz
  2009-04-07 12:14 ` rguenther at suse dot de
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: hubicka at ucw dot cz @ 2009-04-07 11:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from hubicka at ucw dot cz  2009-04-07 11:44 -------
Subject: Re:   New: Local statics not promoted to const

ipa-reference definitly is supposed to do this transform.  I will debug
why it does not in this testcase.

Honza


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39672


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/39672] Local statics not promoted to const
  2009-04-07 11:14 [Bug tree-optimization/39672] New: Local statics not promoted to const rguenth at gcc dot gnu dot org
  2009-04-07 11:44 ` [Bug tree-optimization/39672] " hubicka at ucw dot cz
@ 2009-04-07 12:14 ` rguenther at suse dot de
  2009-04-07 15:14 ` hubicka at ucw dot cz
  2009-04-08 10:21 ` rguenth at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenther at suse dot de @ 2009-04-07 12:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenther at suse dot de  2009-04-07 12:14 -------
Subject: Re:  Local statics not promoted to
 const

On Tue, 7 Apr 2009, hubicka at ucw dot cz wrote:

> ------- Comment #1 from hubicka at ucw dot cz  2009-04-07 11:44 -------
> Subject: Re:   New: Local statics not promoted to const
> 
> ipa-reference definitly is supposed to do this transform.  I will debug
> why it does not in this testcase.

I think it only adjusts global statics.

Richard.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39672


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/39672] Local statics not promoted to const
  2009-04-07 11:14 [Bug tree-optimization/39672] New: Local statics not promoted to const rguenth at gcc dot gnu dot org
  2009-04-07 11:44 ` [Bug tree-optimization/39672] " hubicka at ucw dot cz
  2009-04-07 12:14 ` rguenther at suse dot de
@ 2009-04-07 15:14 ` hubicka at ucw dot cz
  2009-04-08 10:21 ` rguenth at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: hubicka at ucw dot cz @ 2009-04-07 15:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from hubicka at ucw dot cz  2009-04-07 15:14 -------
Subject: Re:  Local statics not promoted to const

> I think it only adjusts global statics.
This is why I originally implemented varpool to have both local and
global static alike, so it should not.

Well, time to debug it ;)

Honza


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39672


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/39672] Local statics not promoted to const
  2009-04-07 11:14 [Bug tree-optimization/39672] New: Local statics not promoted to const rguenth at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-04-07 15:14 ` hubicka at ucw dot cz
@ 2009-04-08 10:21 ` rguenth at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-08 10:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2009-04-08 10:21 -------
Err, this works.  I just messed up my local tree.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |WORKSFORME


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39672


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-04-08 10:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-07 11:14 [Bug tree-optimization/39672] New: Local statics not promoted to const rguenth at gcc dot gnu dot org
2009-04-07 11:44 ` [Bug tree-optimization/39672] " hubicka at ucw dot cz
2009-04-07 12:14 ` rguenther at suse dot de
2009-04-07 15:14 ` hubicka at ucw dot cz
2009-04-08 10:21 ` rguenth at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).