[PATCH] D112948: [SamplePGO] Fix callsite sample lookup to use dwarf names when dwarf linkage name isn't available.
Hongtao Yu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 1 21:25:01 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd13785441253: [SamplePGO] Fix callsite sample lookup to use dwarf names when dwarf linkageā¦ (authored by hoy).
Changed prior to commit:
https://reviews.llvm.org/D112948?vs=383941&id=383958#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112948/new/
https://reviews.llvm.org/D112948
Files:
llvm/lib/ProfileData/SampleProf.cpp
llvm/test/Transforms/SampleProfile/profile-format-compress.ll
llvm/test/Transforms/SampleProfile/profile-format.ll
Index: llvm/test/Transforms/SampleProfile/profile-format.ll
===================================================================
--- llvm/test/Transforms/SampleProfile/profile-format.ll
+++ llvm/test/Transforms/SampleProfile/profile-format.ll
@@ -110,7 +110,7 @@
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5 ", isOptimized: false, emissionKind: NoDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
!1 = !DIFile(filename: "calls.cc", directory: ".")
!2 = !{}
-!4 = distinct !DISubprogram(name: "sum", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 3, file: !1, scope: !5, type: !6, retainedNodes: !2)
+!4 = distinct !DISubprogram(name: "sum", linkageName: "_Z3sumii", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 3, file: !1, scope: !5, type: !6, retainedNodes: !2)
!5 = !DIFile(filename: "calls.cc", directory: ".")
!6 = !DISubroutineType(types: !2)
!7 = distinct !DISubprogram(name: "main", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 7, file: !1, scope: !5, type: !6, retainedNodes: !2)
Index: llvm/test/Transforms/SampleProfile/profile-format-compress.ll
===================================================================
--- llvm/test/Transforms/SampleProfile/profile-format-compress.ll
+++ llvm/test/Transforms/SampleProfile/profile-format-compress.ll
@@ -101,7 +101,7 @@
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5 ", isOptimized: false, emissionKind: NoDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
!1 = !DIFile(filename: "calls.cc", directory: ".")
!2 = !{}
-!4 = distinct !DISubprogram(name: "sum", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 3, file: !1, scope: !5, type: !6, retainedNodes: !2)
+!4 = distinct !DISubprogram(name: "sum", linkageName: "_Z3sumii", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 3, file: !1, scope: !5, type: !6, retainedNodes: !2)
!5 = !DIFile(filename: "calls.cc", directory: ".")
!6 = !DISubroutineType(types: !2)
!7 = distinct !DISubprogram(name: "main", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 7, file: !1, scope: !5, type: !6, retainedNodes: !2)
Index: llvm/lib/ProfileData/SampleProf.cpp
===================================================================
--- llvm/lib/ProfileData/SampleProf.cpp
+++ llvm/lib/ProfileData/SampleProf.cpp
@@ -245,9 +245,13 @@
else
Discriminator = DIL->getBaseDiscriminator();
+ // Use C++ linkage name if possible.
+ StringRef Name = PrevDIL->getScope()->getSubprogram()->getLinkageName();
+ if (Name.empty())
+ Name = PrevDIL->getScope()->getSubprogram()->getName();
+
S.push_back(
- std::make_pair(LineLocation(getOffset(DIL), Discriminator),
- PrevDIL->getScope()->getSubprogram()->getLinkageName()));
+ std::make_pair(LineLocation(getOffset(DIL), Discriminator), Name));
PrevDIL = DIL;
}
if (S.size() == 0)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112948.383958.patch
Type: text/x-patch
Size: 3420 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211102/bedff159/attachment.bin>
More information about the llvm-commits
mailing list