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.
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
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.
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
Err, this works. I just messed up my local tree.