Author: fhahn Date: Fri Apr 19 05:36:41 2019 New Revision: 358753 URL: http://llvm.org/viewvc/llvm-project?rev=358753&view=rev Log: [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 Modified: cfe/trunk/lib/Driver/ToolChains/Darwin.cpp Modified: cfe/trunk/lib/Driver/ToolChains/Darwin.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Darwin.cpp?rev=358753&r1=358752&r2=358753&view=diff ============================================================================== --- cfe/trunk/lib/Driver/ToolChains/Darwin.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Darwin.cpp Fri Apr 19 05:36:41 2019 @@ -514,6 +514,14 @@ void darwin::Linker::ConstructJob(Compil } } + // 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, _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits