Syntax for inlining a Fortran module subroutine

If I have something like:

module foo
   pure function bar()
   end function bar
end module foo

How can I tell nvfortran to inline bar? I’ve tried -Minline=bar and -Minline=foo_bar, but it doesn’t seem like the inliner is being used. bar is trivial, so it shouldn’t be failing inlining criteria.


Just to clarify, I would like a call to bar from outside of foo to be inlined.

Assuming that this is cross file and until we get IPA up and running again (it’s in progress), you’ll need to do a two pass compilation. First pass add “-Mextract=lib:” to extract the inlining information and then a second pass with “-Minline=lib:” to use this info to inline.

While this does now make the inline info available to the compiler, it’s not a guarantee that it will inline. Other factions such as the call depth, size, and if any array args need to be reshaped can limit inlining. You may need to adjust other settings via the -Minline sub-options (see “nvfortran -help -Minline” for the complete list).

Hope this helps,