[clang] 77aec97 - [CSSPGO] Turn on unique linkage name by default for pseudo probe.
Hongtao Yu via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 16 16:43:39 PDT 2021
Author: Hongtao Yu
Date: 2021-07-16T16:43:23-07:00
New Revision: 77aec978a911254299640f9b10bdf1933986b96e
URL: https://github.com/llvm/llvm-project/commit/77aec978a911254299640f9b10bdf1933986b96e
DIFF: https://github.com/llvm/llvm-project/commit/77aec978a911254299640f9b10bdf1933986b96e.diff
LOG: [CSSPGO] Turn on unique linkage name by default for pseudo probe.
Turning on -funique-internal-linkage-names when -fpseudo-probe-for-profiling is on, unless -fno-unique-internal-linkage-names is specified.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D106193
Added:
Modified:
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/pseudo-probe.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 4336a25f091c4..0720ed4bb94a8 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -5972,8 +5972,14 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
Args.AddLastArg(CmdArgs, options::OPT_fprofile_remapping_file_EQ);
if (Args.hasFlag(options::OPT_fpseudo_probe_for_profiling,
- options::OPT_fno_pseudo_probe_for_profiling, false))
+ options::OPT_fno_pseudo_probe_for_profiling, false)) {
CmdArgs.push_back("-fpseudo-probe-for-profiling");
+ // Enforce -funique-internal-linkage-names if it's not explicitly turned
+ // off.
+ if (Args.hasFlag(options::OPT_funique_internal_linkage_names,
+ options::OPT_fno_unique_internal_linkage_names, true))
+ CmdArgs.push_back("-funique-internal-linkage-names");
+ }
}
RenderBuiltinOptions(TC, RawTriple, Args, CmdArgs);
diff --git a/clang/test/Driver/pseudo-probe.c b/clang/test/Driver/pseudo-probe.c
index 297992cfd1a15..79b23df557a6c 100644
--- a/clang/test/Driver/pseudo-probe.c
+++ b/clang/test/Driver/pseudo-probe.c
@@ -1,7 +1,13 @@
// RUN: %clang -### -fpseudo-probe-for-profiling %s 2>&1 | FileCheck %s --check-prefix=YESPROBE
// RUN: %clang -### -fno-pseudo-probe-for-profiling %s 2>&1 | FileCheck %s --check-prefix=NOPROBE
// RUN: %clang -### -fpseudo-probe-for-profiling -fdebug-info-for-profiling %s 2>&1 | FileCheck %s --check-prefix=CONFLICT
+// RUN: %clang -### -fpseudo-probe-for-profiling -funique-internal-linkage-names %s 2>&1 | FileCheck %s --check-prefix=YESPROBE
+// RUN: %clang -### -fpseudo-probe-for-profiling -fno-unique-internal-linkage-names %s 2>&1 | FileCheck %s --check-prefix=NONAME
// YESPROBE: -fpseudo-probe-for-profiling
+// YESPROBE: -funique-internal-linkage-names
// NOPROBE-NOT: -fpseudo-probe-for-profiling
+// NOPROBE-NOT: -funique-internal-linkage-names
+// NONAME: -fpseudo-probe-for-profiling
+// NONAME-NOT: -funique-internal-linkage-names
// CONFLICT: invalid argument
More information about the cfe-commits
mailing list