[PATCH] D35744: Make new PM honor -fdebug-info-for-profiling

Dehao Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 21 15:53:53 PDT 2017


danielcdh created this revision.
Herald added a subscriber: sanjoy.

The new PM needs to invoke add-discriminator pass when building with -fdebug-info-for-profiling.


https://reviews.llvm.org/D35744

Files:
  include/llvm/Passes/PassBuilder.h
  lib/Passes/PassBuilder.cpp


Index: lib/Passes/PassBuilder.cpp
===================================================================
--- lib/Passes/PassBuilder.cpp
+++ lib/Passes/PassBuilder.cpp
@@ -330,6 +330,9 @@
   assert(Level != O0 && "Must request optimizations!");
   FunctionPassManager FPM(DebugLogging);
 
+  if (DebugInfoForProfiling)
+    FPM.addPass(AddDiscriminatorsPass());
+
   // Form SSA out of local memory accesses after breaking apart aggregates into
   // scalars.
   FPM.addPass(SROA());
Index: include/llvm/Passes/PassBuilder.h
===================================================================
--- include/llvm/Passes/PassBuilder.h
+++ include/llvm/Passes/PassBuilder.h
@@ -44,6 +44,7 @@
 class PassBuilder {
   TargetMachine *TM;
   Optional<PGOOptions> PGOOpt;
+  bool DebugInfoForProfiling;
 
 public:
   /// \brief A struct to capture parsed pass pipeline names.
@@ -146,8 +147,9 @@
   };
 
   explicit PassBuilder(TargetMachine *TM = nullptr,
-                       Optional<PGOOptions> PGOOpt = None)
-      : TM(TM), PGOOpt(PGOOpt) {}
+                       Optional<PGOOptions> PGOOpt = None,
+                       bool DebugInfoForProfiling = false)
+      : TM(TM), PGOOpt(PGOOpt), DebugInfoForProfiling(DebugInfoForProfiling) {}
 
   /// \brief Cross register the analysis managers through their proxies.
   ///


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35744.107745.patch
Type: text/x-patch
Size: 1322 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170721/1a7c28d2/attachment.bin>


More information about the llvm-commits mailing list