This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Module functions are not inlined
- From: dominiq at lps dot ens dot fr (Dominique Dhumieres)
- To: fortran at gcc dot gnu dot org
- Cc: fxcoudert at gmail dot com
- Date: Sun, 03 May 2009 12:18:22 +0200
- Subject: Re: Module functions are not inlined
> This is a head's up: I looked at PR 32817
> (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32817 ), and discovered that
> functions form used modules are not inlined by gfortran. I always
> thought they were, so just in case other people think the same as I did,
> I send this mail :)
This is slightly more complicated: contained functions can be inlined
within a module (see the polyhedron test suite for examples), for instance
you can get
call ___free_input_MOD_next
[ibook-dhum] lin/test% gfc -S -O3 fatigue.f90
[ibook-dhum] lin/test% egrep "call[^L]*_.*MOD" fatigue.s
call ___perdida_m_MOD_generalized_hookes_law
call ___perdida_m_MOD_generalized_hookes_law
call ___free_input_MOD_next
[ibook-dhum] lin/test% gfc -S -O3 -finline-limit=500 fatigue.f90
[ibook-dhum] lin/test% egrep "call[^L]*_.*MOD" fatigue.s
[ibook-dhum] lin/test%
where (with the right inlining limit) the functions
perdida_m_MOD_generalized_hookes_law and ___free_input_MOD_next are
inlined. I have seen an example (but cannot find it again) where a
function was called within the module containing it and in the main program
and was inlined in the first case but not in the second.
Cheers,
Dominique