This is the mail archive of the
mailing list for the GCC project.
loop optimization implementation question
- From: Caroline Tice <ctice at apple dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Caroline Tice <ctice at apple dot com>
- Date: Thu, 25 Mar 2004 10:01:29 -0800
- Subject: 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