1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

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
This commit is contained in:
Hongtao Yu 2020-12-22 22:43:22 -08:00
parent e423e154e0
commit ab8997cebd
2 changed files with 3 additions and 1 deletions

View File

@ -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()) {

View File

@ -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: ![[#]]