[llvm-branch-commits] [llvm] 175288a - Add sample-profile-suffix-elision-policy attribute with -funique-internal-linkage-names.
Hongtao Yu via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Jan 12 15:20:36 PST 2021
Author: Hongtao Yu
Date: 2021-01-12T15:15:53-08:00
New Revision: 175288a1afef2b6976455aab5ce51c66d28f8bca
URL: https://github.com/llvm/llvm-project/commit/175288a1afef2b6976455aab5ce51c66d28f8bca
DIFF: https://github.com/llvm/llvm-project/commit/175288a1afef2b6976455aab5ce51c66d28f8bca.diff
LOG: Add sample-profile-suffix-elision-policy attribute with -funique-internal-linkage-names.
Adding sample-profile-suffix-elision-policy attribute to functions whose linkage names are uniquefied so that their unique name suffix won't be trimmed when applying AutoFDO profiles.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D94455
Added:
Modified:
llvm/lib/Transforms/Utils/UniqueInternalLinkageNames.cpp
llvm/test/Transforms/UniqueInternalLinkageNames/unique-internal-linkage-names.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/UniqueInternalLinkageNames.cpp b/llvm/lib/Transforms/Utils/UniqueInternalLinkageNames.cpp
index 2909403fdb10..c57cec6be676 100644
--- a/llvm/lib/Transforms/Utils/UniqueInternalLinkageNames.cpp
+++ b/llvm/lib/Transforms/Utils/UniqueInternalLinkageNames.cpp
@@ -43,6 +43,7 @@ static bool uniqueifyInternalLinkageNames(Module &M) {
for (auto &F : M) {
if (F.hasInternalLinkage()) {
F.setName(F.getName() + ModuleNameHash);
+ F.addFnAttr("sample-profile-suffix-elision-policy", "selected");
// Replace linkage names in the debug metadata.
if (DISubprogram *SP = F.getSubprogram()) {
if (SP->getRawLinkageName()) {
diff --git a/llvm/test/Transforms/UniqueInternalLinkageNames/unique-internal-linkage-names.ll b/llvm/test/Transforms/UniqueInternalLinkageNames/unique-internal-linkage-names.ll
index d07440d1b940..dcb49d9b7a51 100644
--- a/llvm/test/Transforms/UniqueInternalLinkageNames/unique-internal-linkage-names.ll
+++ b/llvm/test/Transforms/UniqueInternalLinkageNames/unique-internal-linkage-names.ll
@@ -42,8 +42,9 @@ entry:
; O2: Running pass: UniqueInternalLinkageNamesPass
; O2: Running pass: SampleProfileProbePass
-; UNIQUE: define internal i32 @foo.__uniq.{{[0-9]+}}()
+; UNIQUE: define internal i32 @foo.__uniq.{{[0-9]+}}() [[ATTR:#[0-9]+]]
; UNIQUE: ret {{.*}} @foo.__uniq.{{[0-9]+}} {{.*}}
+; UNIQUE: attributes [[ATTR]] = {{{.*}} "sample-profile-suffix-elision-policy"="selected" {{.*}}}
; DBG: distinct !DISubprogram(name: "foo", linkageName: "foo.__uniq.{{[0-9]+}}", scope: ![[#]]
; DBG: !DISubprogram(name: "foo", linkageName: "foo.__uniq.{{[0-9]+}}", scope: ![[#]]
More information about the llvm-branch-commits
mailing list