From 9c6f1538cc0f70fe43d47cf818ad797c82b61d5f Mon Sep 17 00:00:00 2001 From: Rong Xu Date: Wed, 2 Mar 2016 20:59:36 +0000 Subject: [PGO] Change profile use cc1 option to handle IR level profiles This patch changes cc1 option for PGO profile use from -fprofile-instr-use= to -fprofile-instrument-use-path=. -fprofile-instr-use= is now a driver only option. In addition to decouple the cc1 option from the driver level option, this patch also enables IR level profile use. cc1 option handling now reads the profile header and sets CodeGenOpt ProfileUse (valid values are {None, Clang, LLVM} -- this is a common enum for -fprofile-instrument={}, for the profile instrumentation), and invoke the pipeline to enable the respective PGO use pass. Reviewers: silvas, davidxl Differential Revision: http://reviews.llvm.org/D17737 llvm-svn: 262515 --- clang/lib/Driver/Tools.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'clang/lib/Driver/Tools.cpp') diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 0f5c700ce61..6e97183da1c 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -3301,7 +3301,8 @@ static void addPGOAndCoverageFlags(Compilation &C, const Driver &D, if (ProfileUseArg) { if (ProfileUseArg->getOption().matches(options::OPT_fprofile_instr_use_EQ)) - ProfileUseArg->render(Args, CmdArgs); + CmdArgs.push_back(Args.MakeArgString( + Twine("-fprofile-instrument-use-path=") + ProfileUseArg->getValue())); else if ((ProfileUseArg->getOption().matches( options::OPT_fprofile_use_EQ) || ProfileUseArg->getOption().matches( @@ -3311,7 +3312,7 @@ static void addPGOAndCoverageFlags(Compilation &C, const Driver &D, if (Path.empty() || llvm::sys::fs::is_directory(Path)) llvm::sys::path::append(Path, "default.profdata"); CmdArgs.push_back( - Args.MakeArgString(Twine("-fprofile-instr-use=") + Path)); + Args.MakeArgString(Twine("-fprofile-instrument-use-path=") + Path)); } } -- cgit v1.2.3