7 Commits

Author SHA1 Message Date
Hans Wennborg
5f10dae16e EntryExitInstrumenter: Handle musttail calls
Inserting instrumentation between a musttail call and ret instruction
would create invalid IR. Instead, treat musttail calls as function
exits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329385 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-06 10:14:09 +00:00
David Blaikie
49ca55e381 Transforms: Introduce Transforms/Utils.h rather than spreading the declarations amongst Scalar.h and IPO.h
Fixes layering - Transforms/Utils shouldn't depend on including a Scalar
or IPO header, because Scalar and IPO depend on Utils.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328717 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-28 17:44:36 +00:00
David Blaikie
679790c5c0 Remove unused header from EntryExitInstrumenter
Fixes layering, since Transforms/Utils doesn't depend on CodeGen, so
shouldn't include headers from it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328399 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-24 00:06:14 +00:00
Hans Wennborg
dd74d55407 EntryExitInstrumenter: set DebugLocs on the inserted call instructions (PR35412)
Apparently the verifier requires that inlineable calls in a function
with debug info have debug locations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319199 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-28 18:44:26 +00:00
Hans Wennborg
11764345cd EntryExitInstrumenter: support __cyg_profile_func_enter_bare
It works just like __cyg_profile_func_enter but takes no arguments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318783 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-21 17:22:19 +00:00
Davide Italiano
eaa439c25a [EntryExitInstrumenter] Placate GCC, the semicolon is redundant. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318217 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-14 23:13:38 +00:00
Hans Wennborg
5765d84997 Rename CountingFunctionInserter and use for both mcount and cygprofile calls, before and after inlining
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.)

LLVM already has a pass for inserting similar instrumentation calls to
mcount(), which it does after inlining. This patch renames and extends that
pass to handle calls both to mcount and the cygprofile functions, before and/or
after inlining as controlled by function attributes.

Differential Revision: https://reviews.llvm.org/D39287

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318195 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-14 21:09:45 +00:00