diff options
author | Dehao Chen <dehao@google.com> | 2017-06-29 23:33:13 +0000 |
---|---|---|
committer | Dehao Chen <dehao@google.com> | 2017-06-29 23:33:13 +0000 |
commit | 6d441bf05f5594902077d32e82aacb9e9ab16c88 (patch) | |
tree | f81b34957fad6c25d9bf9360db5033bd64364758 /clang/lib/CodeGen/BackendUtil.cpp | |
parent | 2f31d0d86e924c95b4b4ff3d2c7b165204ebaa9a (diff) | |
download | llvm-6d441bf05f5594902077d32e82aacb9e9ab16c88.zip llvm-6d441bf05f5594902077d32e82aacb9e9ab16c88.tar.gz llvm-6d441bf05f5594902077d32e82aacb9e9ab16c88.tar.bz2 |
[PM] Add support for sample PGO in the new pass manager (clang-side)
Summary: This implements the clang bits of https://reviews.llvm.org/D34720, and add corresponding test to verify if it worked.
Reviewers: chandlerc, davidxl, davide, tejohnson
Reviewed By: chandlerc, tejohnson
Subscribers: tejohnson, sanjoy, mehdi_amini, eraman, cfe-commits
Differential Revision: https://reviews.llvm.org/D34721
llvm-svn: 306764
Diffstat (limited to 'clang/lib/CodeGen/BackendUtil.cpp')
-rw-r--r-- | clang/lib/CodeGen/BackendUtil.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index 67ccbcd..fcd0550 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -857,11 +857,15 @@ void EmitAssemblyHelper::EmitAssemblyWithNewPassManager( if (CodeGenOpts.hasProfileIRUse()) PGOOpt.ProfileUseFile = CodeGenOpts.ProfileInstrumentUsePath; + if (!CodeGenOpts.SampleProfileFile.empty()) + PGOOpt.SampleProfileFile = CodeGenOpts.SampleProfileFile; + // Only pass a PGO options struct if -fprofile-generate or // -fprofile-use were passed on the cmdline. PassBuilder PB(TM.get(), (PGOOpt.RunProfileGen || - !PGOOpt.ProfileUseFile.empty()) ? + !PGOOpt.ProfileUseFile.empty() || + !PGOOpt.SampleProfileFile.empty()) ? Optional<PGOOptions>(PGOOpt) : None); LoopAnalysisManager LAM; |