This is the mail archive of the gcc-patches@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]

[struct-reorg] strip struct frame from one-field structures.


This patch extends struct-reorg optimizations with an ability to strip a
structure frame from one-field structures.

For example, the variable 'a' of structure type:

typedef struct str
{
        int* a;
}
str a;

will be replaced with
int* a;

It works for both user-defined and compiler generated structures, as, for
example, those produced after structure peeling.
The param struct-reorg-strip-struct was added to activate this
optimization.

With this patch we measured additional 15% on 179.art over basic
struct-reorg on p5.
But more than that, it opens further opportunities to subsequent
optimizations by simplifying variable type
from 'structure' type to field type, that might be easier to analyze and
transform. For example, with this
patch a one-field structure with an array field becomes a subject for
matrix flattening and transposing,
while without this patch it is not.

Bootstrapped and regtested on p5. The patch with specific tests cases is on
the way.

OK for struct-reorg branch?

Alon

(See attached file: strip.txt)

Attachment: strip.txt
Description: Text document


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