This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Fix PR19401: always completely peel loops
On Jan 13, 2005, at 6:09 PM, Gabriel Dos Reis wrote:
I disagree. Optimizations should support language usages/patterns and
language idioms. Not all languages have the same idioms or usage
patterns. There are optimizations that can benefits to set of
languages; but not all of them fall into that observation.
We've been through this many times.
Yes they might use different idioms but most of the time the
optimizations don't do anything for the languages which use
that feature so it should not matter to them. Anything which turns
on a language specific optimization should then be in the
front-end and no where else because the middle-end/tree/rtl
optimizations are for generic optimizations which apply on more
than language. Idioms are for programmers and not for compilers.
Someone should be able to take a C++ program and still use the
same idiom and convert it to C and compile with GCC and still
get the same optimization and speed out of it. An example is
passing via reference.
My usual rant is about basing C++ optimizations on C APIs and usage,
which often leads to severe pessimizations.
But my point is that people write loops the same way in both C and C++
and many different languages too, which is why this should be enabled
for more than just the C++ front-end, the examples where I find this
helpfully is more than just in C++ code but in many C code.
GCC contains many examples of where loops should be unrolled/peeled
and being scalarized so that argument is mute in this case (and most
likely others too which are not mentioned here).
Sorry for the rant.
--- Pinski