[PATCH] D39287: Add a flag to disable inlining calls to cygprofile functions generated by -finstrument-functions

Hans Wennborg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 25 07:08:23 PDT 2017


hans created this revision.
Herald added a subscriber: eraman.

Clang implements the -finstrument-functions flag inherited from GCC, which inserts calls to __cyg_profile_func_{enter,exit} on function entry and exit.

This is useful for getting a trace of how the functions in a program are executed. Normally, the calls remain even if a function is inlined into another function, but it is useful to be able to turn this off for users who are interested in a lower-level trace, i.e. one that reflects what functions are called post-inlining. (We use this to generate link order files for Chromium.)

This patch adds a mode to not drop the cygprofile calls during inlining, and to also ignore them during inline cost analysis. It's not elegant, but I think it's pretty pragmatic.


https://reviews.llvm.org/D39287

Files:
  lib/Analysis/InlineCost.cpp
  lib/Transforms/Utils/CloneFunction.cpp
  test/Transforms/Inline/cygprofile-instrumentation.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39287.120242.patch
Type: text/x-patch
Size: 4461 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171025/4631debf/attachment.bin>


More information about the llvm-commits mailing list