Hi, all, I do not want to modify the old loop optimizer defined in loop.c. I am preparing to port some improvements done on gcc-3.5 to gcc-4.0, and the GIV optimizations is one of my concerns.
On IA-64, the GIV optimizations can hardly improve the performance. The reason is that check_ext_dependent_givs can not give an exactly answer whether the BIVs will be wrap around or not. As check_ext_dependent_givs can only deal with BIVs in constant-iteration loops or BIVs are the same as the loop iteration variable, and only small parts of BIVs satisfy this condition, that in most cases, only a conservative result is produced to report that the BIVs may overflow and the corresponding GIVs can not be reduced. I modified the code in check_ext_dependent_givs to let the BIVs always successfully pass the check, then tested the NAS benchmarks and SPEC CPF2000 benchmarks, excepting significant performance improvements, no extra errors occurred. I have read the codes in check_ext_dependent_givs and the mails abount BIV overflow checking in GCC's mailing list written by Richard Henderson and Zdenek Dvorak, also tested the example Paolo Bonzini sent to me. But I still have some questions about this. 1. There is an option '-fwrapv' to control the behavior of signed overflows. Can it also be used in check_ext_dependent_givs? 2. If check_ext_dependent_givs has not been invoked, the program will give wrong result, otherwise, correct. Would you please send me an example to show this? (FORTRAN programs are nicer). 3. For FORTRAN programs, is there any thing special. As I know, only signed integers in FORTRAN, also the counted loops in FORTRAN are more strict than in C? 4. Is it reasonable to turn off this checking at some optimization level or with compile options like '- ffast-math' and '-fno-wrapv'? 5. Is there any way to extend the function of check_ext_dependent_givs to manage non-iteration-variable BIVs in non-constant-iteration loops. I have tried but failed. Best regards, Canqun Yang Creative Compiler Research Group. National University of Defense Technology, China.