diff options
author | Adam Nemet <anemet@apple.com> | 2016-11-18 18:17:36 +0000 |
---|---|---|
committer | Adam Nemet <anemet@apple.com> | 2016-11-18 18:17:36 +0000 |
commit | e4b9fd985214456ac9597567868da124d0b8d85d (patch) | |
tree | 0c4b6cbf23ee5a6bb6ee77ec38dc624298f23c37 /clang/lib/Driver/Tools.cpp | |
parent | 62ff7bab720d954c0c2e3bb4d984446e3f5e9e5a (diff) | |
download | llvm-e4b9fd985214456ac9597567868da124d0b8d85d.zip llvm-e4b9fd985214456ac9597567868da124d0b8d85d.tar.gz llvm-e4b9fd985214456ac9597567868da124d0b8d85d.tar.bz2 |
LTO support for -fsave-optimization-record on Darwin
I guess this would have to be added for each linker.
Differential Revision: https://reviews.llvm.org/D26833
llvm-svn: 287358
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index f5295f3..8fc34ab 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -8416,6 +8416,19 @@ void darwin::Linker::ConstructJob(Compilation &C, const JobAction &JA, // we follow suite for ease of comparison. AddLinkArgs(C, Args, CmdArgs, Inputs); + // For LTO, pass the name of the optimization record file. + if (Args.hasFlag(options::OPT_fsave_optimization_record, + options::OPT_fno_save_optimization_record, false)) { + CmdArgs.push_back("-mllvm"); + CmdArgs.push_back("-pass-remarks-output"); + CmdArgs.push_back("-mllvm"); + + SmallString<128> F; + F = Output.getFilename(); + F += ".opt.yaml"; + CmdArgs.push_back(Args.MakeArgString(F)); + } + // 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, |