diff options
author | Florian Hahn <flo@fhahn.com> | 2019-04-19 12:36:41 +0000 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2019-04-19 12:36:41 +0000 |
commit | a558e8d6fe4fb7b5d75cf15cdd08181bb4e9ac07 (patch) | |
tree | d31502f9c569a65c67596744926ff2eab947075d /lib/Driver/ToolChains/Darwin.cpp | |
parent | 333e5a248f5a13195028fe7adb59870f6601fec8 (diff) |
[LTO] Add plumbing to save stats during LTO on Darwin.
Gold and ld on Linux already support saving stats, but the
infrastructure is missing on Darwin. Unfortunately it seems like the
configuration from lib/LTO/LTO.cpp is not used.
This patch adds a new LTOStatsFile option and adds plumbing in Clang to
use it on Darwin, similar to the way remarks are handled.
Currnetly the handling of LTO flags seems quite spread out, with a bunch
of duplication. But I am not sure if there is an easy way to improve
that?
Reviewers: anemet, tejohnson, thegameg, steven_wu
Reviewed By: steven_wu
Differential Revision: https://reviews.llvm.org/D60516
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358753 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChains/Darwin.cpp')
-rw-r--r-- | lib/Driver/ToolChains/Darwin.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Driver/ToolChains/Darwin.cpp b/lib/Driver/ToolChains/Darwin.cpp index 344143668b..20ef6a894e 100644 --- a/lib/Driver/ToolChains/Darwin.cpp +++ b/lib/Driver/ToolChains/Darwin.cpp @@ -514,6 +514,14 @@ void darwin::Linker::ConstructJob(Compilation &C, const JobAction &JA, } } + // Setup statistics file output. + SmallString<128> StatsFile = + getStatsFileName(Args, Output, Inputs[0], getToolChain().getDriver()); + if (!StatsFile.empty()) { + CmdArgs.push_back("-mllvm"); + CmdArgs.push_back(Args.MakeArgString("-lto-stats-file=" + StatsFile.str())); + } + // It seems that the 'e' option is completely ignored for dynamic executables // (the default), and with static executables, the last one wins, as expected. Args.AddAllArgs(CmdArgs, {options::OPT_d_Flag, options::OPT_s, options::OPT_t, |