[PATCH] D29309: [PM] Add support for instrumented PGO in the new pass manager (clang-side)

Davide Italiano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 30 14:40:38 PST 2017


davide created this revision.

This implements the clang bits of https://reviews.llvm.org/D29308
I'm planning to use this to test the PGO inliner changes available only in the new pass manager.
I'm not very familiar with the clang driver so I'm not sure if this change is correct. PTAL (also suggestions on how to best test this are welcome).


https://reviews.llvm.org/D29309

Files:
  lib/CodeGen/BackendUtil.cpp


Index: lib/CodeGen/BackendUtil.cpp
===================================================================
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -796,6 +796,17 @@
 
   ModulePassManager MPM;
 
+  // Setup PGO options.
+  if (CodeGenOpts.hasProfileIRInstr()) {
+    PB.RunProfileGen = true;
+    if (!CodeGenOpts.InstrProfileOutput.empty())
+      PB.ProfileGenFile = CodeGenOpts.InstrProfileOutput;
+    else
+      PB.ProfileGenFile = "default_%m.profraw";
+  }
+  if (CodeGenOpts.hasProfileIRUse())
+    PB.ProfileUseFile = CodeGenOpts.ProfileInstrumentUsePath;
+
   if (!CodeGenOpts.DisableLLVMPasses) {
     if (CodeGenOpts.OptimizationLevel == 0) {
       // Build a minimal pipeline based on the semantics required by Clang,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29309.86353.patch
Type: text/x-patch
Size: 756 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170130/0738c6e9/attachment.bin>


More information about the llvm-commits mailing list