------- Comment #15 from dominiq at lps dot ens dot fr  2009-08-25 15:30 -------
I think I have made some progress to understand the problem:

(1) The 1,953,139,629 or so calls to pow() are the non optimized base.

(2) For working situations this number is reduced to 63,907,869 or so when
using the -funsafe-math-optimizations option:

[ibook-dhum] lin/test% time a.out > /dev/null
11.348u 0.049s 0:11.41 99.7%    0+0k 0+7io 0pf+0w
[ibook-dhum] lin/test% gfc -m64 -O2 -funsafe-math-optimizations air.f90
[ibook-dhum] lin/test% time a.out > /dev/null
8.464u 0.046s 0:08.52 99.7%     0+0k 0+8io 0pf+0w
[ibook-dhum] lin/test% gfc -fwhole-file -m64 -O2 -funsafe-math-optimizations
air.f90
[ibook-dhum] lin/test% time a.out > /dev/null
8.471u 0.047s 0:08.53 99.7%     0+0k 0+7io 0pf+0w

so with -O2 -funsafe-math-optimizations the optimization is still there with
-fwhole-file.

(3) The critical option with -fwhole-file is -finline-functions:

[ibook-dhum] lin/test% gfc -m64 -O2 -finline-functions
-funsafe-math-optimizations air.f90
[ibook-dhum] lin/test% time a.out > /dev/null
8.464u 0.045s 0:08.52 99.7%     0+0k 0+8io 0pf+0w
[ibook-dhum] lin/test% gfc -fwhole-file -m64 -O2 -finline-functions
-funsafe-math-optimizations air.f90
[ibook-dhum] lin/test% time a.out > /dev/null
10.053u 0.046s 0:10.11 99.8%    0+0k 0+8io 0pf+0w

Note that the patch in http://gcc.gnu.org/ml/fortran/2009-08/msg00361.html
seems to prevent the optimization coming from -funsafe-math-optimizations (see
http://gcc.gnu.org/ml/fortran/2009-08/msg00390.html ).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40106

Reply via email to