[PATCH, Loop optimizer]: Add logic to disable certain loop optimizations on pre-/post-loops

Fang, Changpeng Changpeng.Fang@amd.com
Mon Dec 13 21:57:00 GMT 2010


Hi,

The attached patch adds the logic to disable certain loop optimizations on pre-/post-loops. 

Some loop optimizations (auto-vectorization, loop unrolling, etc) may peel a few iterations
of a loop to form pre- and/or post-loops for various purposes (alignment, loop bounds, etc).
Currently, GCC loop optimizer is unable to recognize that such loops will roll only a few 
iterations and still perform optimizations on them. While this does not hurt the performance in general,
it may significantly increase the compilation time and code size without performance benefit.

This patch adds such logic for the loop optimizer to recognize pre- and/or post loops, and disable
prefetch, unswitch and loop unrolling on them. On polyhedron with -Ofast -funroll-loops -march=amdfam10,
the patch could reduce the compilation time by 28% on average, the reduce the binary size by 20% on
 average (see the atached data).  Note that the small improvement (0.5%) could have been noise, the
code size reduction could possibly improve the performance in some cases (I_cache iprovement?).

The patch passed bootstrap and gcc regression tests on x86_64-unknown-linux-gnu.

Is it OK to commit to trunk?

Thanks,

Changpeng
   
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: polyhedron.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20101213/1761a0ac/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Don-t-perform-certain-loop-optimizations-on-pre-post.patch
Type: text/x-patch
Size: 8306 bytes
Desc: 0001-Don-t-perform-certain-loop-optimizations-on-pre-post.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20101213/1761a0ac/attachment.bin>


More information about the Gcc-patches mailing list