[LLVMdev] llvm-gcc loop unrolling
Evan Jones
ejones at uwaterloo.ca
Wed Apr 20 06:41:07 PDT 2005
What component is responsible for loop unrolling, llvm-gcc, or some
LLVM pass after GCC? When compiling this function:
void printArray( int array[16] ) {
for( int i = 0; i < 16; ++ i ) {
printf( "%d\n", array[i] );
}
}
llvm-gcc chooses to unroll this loop, and I don't think it should. It
doesn't unroll the loop if there are 17 iterations, only 16. It also
produces this output even when compiling with -Os, which is supposed to
turn off optimizations like this.
Wouldn't it be better to leave the loop unrolling to some later
optimization pass? This way, future passes can easily recognize that
this is in fact a loop.
Evan Jones
More information about the llvm-dev
mailing list