aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-profdata/llvm-profdata.cpp
diff options
context:
space:
mode:
authorEllis Hoag <ellis.sparky.hoag@gmail.com>2024-01-04 16:13:57 -0800
committerGitHub <noreply@github.com>2024-01-04 16:13:57 -0800
commit9a2df55f47e4ec02a1efbf8efa776cfeed527df2 (patch)
tree09e1563ea60c635d5a0bb42bd473576a20905b0c /llvm/tools/llvm-profdata/llvm-profdata.cpp
parent786cf76f434d2691878067dedb8b1eb99472810b (diff)
downloadllvm-9a2df55f47e4ec02a1efbf8efa776cfeed527df2.zip
llvm-9a2df55f47e4ec02a1efbf8efa776cfeed527df2.tar.gz
llvm-9a2df55f47e4ec02a1efbf8efa776cfeed527df2.tar.bz2
[InstrProf] No linkage prefixes in IRPGO names (#76994)
Change the format of IRPGO counter names to `[<filepath>;]<mangled-name>` which is computed by `GlobalValue::getGlobalIdentifier()` to fix #74565. In fe051934cbb0aaf25d960d7d45305135635d650b (https://reviews.llvm.org/D156569) the format of IRPGO counter names was changed to be `[<filepath>;]<linkage-name>` where `<linkage-name>` is basically `F.getName()` with some prefix, e.g., `_` or `l_` on Mach-O (yes, it is confusing that `<linkage-name>` is computed with `Mangler().getNameWithPrefix()` while `<mangled-name>` is just `F.getName()`). We discovered in #74565 that this causes some missed import issues on some targets and #74008 is a partial fix. Since `<mangled-name>` may not match the `<linkage-name>` on some targets like Mach-O, we will need to post-process the output of `llvm-profdata order` before passing to the linker via `-order_file`. Profiles generated after fe051934cbb0aaf25d960d7d45305135635d650b will become stale after this diff, but I think this is acceptable since that patch landed after the LLVM 18 cut which hasn't been released yet.
Diffstat (limited to 'llvm/tools/llvm-profdata/llvm-profdata.cpp')
-rw-r--r--llvm/tools/llvm-profdata/llvm-profdata.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp
index 77197d3..05e96f48 100644
--- a/llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -3158,7 +3158,11 @@ static int order_main(int argc, const char *argv[]) {
BalancedPartitioning BP(Config);
BP.run(Nodes);
- WithColor::note() << "# Ordered " << Nodes.size() << " functions\n";
+ OS << "# Ordered " << Nodes.size() << " functions\n";
+ OS << "# Warning: Mach-O may prefix symbols with \"_\" depending on the "
+ "linkage and this output does not take that into account. Some "
+ "post-processing may be required before passing to the linker via "
+ "-order_file.\n";
for (auto &N : Nodes) {
auto [Filename, ParsedFuncName] =
getParsedIRPGOFuncName(Reader->getSymtab().getFuncOrVarName(N.Id));