This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/35561] New: Promote written once local aggregates to static


// 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]