This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/35561] New: Promote written once local aggregates to static
- From: "xinliangli at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Mar 2008 20:59:17 -0000
- Subject: [Bug middle-end/35561] New: Promote written once local aggregates to static
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
// David Li
In some programs (not so rare), local arrays/aggregates are used to hold some
program parameters that never change. Such local arrays are candidates for
being promoted into readonly static data, in order to 1) reducing stack size;
2) avoid paying the overhead of the initializing the array each time the
routine is entered.
Such optimization can be extended to cases when the local array is defined once
on entry of a single entry routine, read within the region, but not live out of
it (such cases can be created due to inlining).
Example:
int foo(...)
{
int coeff_array[30] = {1,2,3.......};
..... = coeff_array[i];
..
}
--
Summary: Promote written once local aggregates to static
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: xinliangli at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35561