This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Optimisation question/suggestion
- To: egcs at cygnus dot com
- Subject: Optimisation question/suggestion
- From: Xavier Bouchoux <xbouchou at ensisun dot imag dot fr>
- Date: Wed, 14 Jan 1998 17:37:16 +0100
Hi!
egcs is a really great compiler, that performs lots of cse, and
other tricks...
but: (of course... ;-)
there is some more factorisation that would be interresting:
int i,cond;
cond = [something];
for (i=0; i<1000; i++) {
if (condition) {
[piece of code 1]
} else {
[piece of code 2]
}
}
as condition doesn't change during the loop, it could be better compiled
if transformed in:
int i,cond;
if (condition) {
for (i=0; i<1000; i++) {
[piece of code 1]
}
} else {
for (i=0; i<1000; i++) {
[piece of code 2]
}
}
I don't know if that's easy to do, but that would be really great:
making 3 or 4 versions of the loops acording to condition inside...
I don't have for the moment enough time to dig into gcc and understand
how it works to implement this, so I let this a suggestion...
Bye!