[PATCH] D95271: [CSSPGO] Passing the clang driver switch -fpseudo-probe-for-profiling to the linker.

Hongtao Yu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 22 15:53:17 PST 2021


hoy created this revision.
Herald added subscribers: wenlei, dang, steven_wu, hiraditya.
Herald added a reviewer: jansvoboda11.
hoy requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

As titled.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95271

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/test/Driver/pseudo-probe-lto.c


Index: clang/test/Driver/pseudo-probe-lto.c
===================================================================
--- /dev/null
+++ clang/test/Driver/pseudo-probe-lto.c
@@ -0,0 +1,5 @@
+// RUN: touch %t.o
+// RUN: %clang -### %t.o -flto -fpseudo-probe-for-profiling 2>&1 | FileCheck %s
+// RUN: %clang -### %t.o -flto=thin -fpseudo-probe-for-profiling 2>&1 | FileCheck %s
+
+// CHECK: -plugin-opt=pseudo-probe-for-profiling
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===================================================================
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -605,6 +605,10 @@
       CmdArgs.push_back("-plugin-opt=new-pass-manager");
   }
 
+  // Pass an option to enable pseudo probe emission.
+  if (Args.hasArg(options::OPT_fpseudo_probe_for_profiling))
+    CmdArgs.push_back("-plugin-opt=pseudo-probe-for-profiling");
+
   // Setup statistics file output.
   SmallString<128> StatsFile = getStatsFileName(Args, Output, Input, D);
   if (!StatsFile.empty())
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -1221,7 +1221,7 @@
 defm pseudo_probe_for_profiling : BoolFOption<"pseudo-probe-for-profiling",
   CodeGenOpts<"PseudoProbeForProfiling">, DefaultsToFalse,
   ChangedBy<PosFlag, [], "Emit">, ResetBy<NegFlag, [], "Do not emit">,
-  BothFlags<[NoXarchOption, CC1Option], " pseudo probes for sample profiler">>;
+  BothFlags<[NoXarchOption, CC1Option], " pseudo probes for sample profiling">>;
 def forder_file_instrumentation : Flag<["-"], "forder-file-instrumentation">,
     Group<f_Group>, Flags<[CC1Option, CoreOption]>,
     HelpText<"Generate instrumented code to collect order file into default.profraw file (overridden by '=' form of option or LLVM_PROFILE_FILE env var)">;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95271.318672.patch
Type: text/x-patch
Size: 1921 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210122/abde979b/attachment.bin>


More information about the cfe-commits mailing list