[PATCH] D94455: Add sample-profile-suffix-elision-policy attribute with -funique-internal-linkage-names.

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 11 14:45:50 PST 2021


hoy created this revision.
Herald added subscribers: wenlei, hiraditya.
hoy requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94455

Files:
  llvm/lib/Transforms/Utils/UniqueInternalLinkageNames.cpp
  llvm/test/Transforms/UniqueInternalLinkageNames/unique-internal-linkage-names.ll


Index: llvm/test/Transforms/UniqueInternalLinkageNames/unique-internal-linkage-names.ll
===================================================================
--- llvm/test/Transforms/UniqueInternalLinkageNames/unique-internal-linkage-names.ll
+++ llvm/test/Transforms/UniqueInternalLinkageNames/unique-internal-linkage-names.ll
@@ -42,8 +42,9 @@
 ; 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: ![[#]]
Index: llvm/lib/Transforms/Utils/UniqueInternalLinkageNames.cpp
===================================================================
--- llvm/lib/Transforms/Utils/UniqueInternalLinkageNames.cpp
+++ llvm/lib/Transforms/Utils/UniqueInternalLinkageNames.cpp
@@ -43,6 +43,7 @@
   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()) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94455.315942.patch
Type: text/x-patch
Size: 1503 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210111/471dcdb0/attachment.bin>


More information about the llvm-commits mailing list