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]

loop optimization implementation question


I am in the process of trying to migrate an optimization from Apple's 3.3 compiler to the FSF 3.5 compiler. The
optimization takes very simple 'for' and 'while' loops that zero out an array or contiguous area of memory, and
replaces the loops with appropriate calls to 'memset'.


In the 3.3 compiler, this transformation occurs in the front end, in finish_function (c-decl.c). I am having
difficulty deciding where, in the 3.5 compiler, would be the most appropriate place to put this. At first
I thought about doing it in the tree-ssa optimizations, but this optimization isn't really a good tree-ssa
optimization because it changes the shape of the cfg (all the loop blocks and split/join edges are removed,
and replace with a single straight-line flow block containing a function call), which means adding a fair amount of
complexity to fix up all the phi-nodes and ssa variables. I know that *can* be done, but if there's no real *need* to
do it in the ssa form, then why go to the extra bother. But I am not yet an expert at the gcc tree-ssa code, so
maybe I'm missing something. My real question is: should this optimization happen before the tree
gets genericized? After generic but before gimple? After gimple but before ssa? Or in ssa?


All advice and suggestions on the best way to go about this would be very welcome. Thanks in advance!
Also, is anyone working (or has anyone worked) on a similar optimization is gcc?


-- Caroline Tice
ctice@apple.com


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