This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/15432] New: -finstrument-functions disables inlining


The -finstrument-functions option instructs GCC to insert calls to 
__cyg_profile_func_enter() and __cyg_profile_func_exit() at the entry and exit 
of every C function body.  In previous versions of GCC (e.g. 3.0.4), this 
instrumentation only applied to the final function bodies after inlining had 
occurred, but with GCC 3.4 it now appears that inline functions are also 
instrumented.

Since the -finstrument-functions feature is intended for profiling the runtime 
behavior of a project, it seems strange to apply this analysis before powerful 
optimizations that can eliminate function calls entirely.  In my case, I am 
using __cyg_profile_func_enter() to track the stack depth at various points in 
the program, and the absence of inlining (in C++) produces vast quantities of 
extraneous little function calls that are not at all representative of the real 
program behavior.

By comparison, I believe Microsoft applied similar reasoning when implementing 
their _penter() and _pexit() hooks for Visual C++.

-- 
           Summary: -finstrument-functions disables inlining
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pgonzalez at bluel dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-cygwin
  GCC host triplet: i686-pc-cygwin
GCC target triplet: arm-arm-elf


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]