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

Wei Mi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 1 23:19:36 PST 2021


wmi added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:609-610
+  // Pass an option to enable pseudo probe emission.
+  if (Args.hasFlag(options::OPT_fpseudo_probe_for_profiling,
+                   options::OPT_fno_pseudo_probe_for_profiling))
+    CmdArgs.push_back("-plugin-opt=pseudo-probe-for-profiling");
----------------
The third arg of Args.hasFlag defaults to true, which means -plugin-opt=pseudo-probe-for-profiling will be inserted even if no -fpseudo-probe-for-profiling or -fno-pseudo-probe-for-profiling is provided. Is it expected?


================
Comment at: clang/test/Driver/pseudo-probe-lto.c:6
+// RUN: %clang -### %t.o -target x86_64-unknown-linux -flto -fno-pseudo-probe-for-profiling 2>&1 | FileCheck %s --check-prefix=NOPROBE
+// RUN: %clang -### %t.o -target x86_64-unknown-linux -flto -fpseudo-probe-for-profiling -fno-pseudo-probe-for-profiling 2>&1 | FileCheck %s --check-prefix=NOPROBE
+
----------------
Better add another check of NOPROBE when neither -fpseudo-probe-for-profiling or -fno-pseudo-probe-for-profiling is provided. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95271/new/

https://reviews.llvm.org/D95271



More information about the cfe-commits mailing list