[PATCH] D142073: [BOLT] Handle __uniq prefix added by -funique-internal-linkage-names
Amir Ayupov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 20 16:00:41 PST 2023
Amir updated this revision to Diff 491000.
Amir added a comment.
Herald added subscribers: ormris, steven_wu, hiraditya.
Update lto-name-match.s
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142073/new/
https://reviews.llvm.org/D142073
Files:
bolt/lib/Profile/DataReader.cpp
bolt/test/X86/lto-name-match.s
Index: bolt/test/X86/lto-name-match.s
===================================================================
--- bolt/test/X86/lto-name-match.s
+++ bolt/test/X86/lto-name-match.s
@@ -1,5 +1,3 @@
-# REQUIRES: system-linux
-
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
# RUN: link_fdata %s %t.o %t.fdata
# RUN: llvm-strip --strip-unneeded %t.o
@@ -9,7 +7,7 @@
## Check that profile is correctly matched by functions with variable suffixes.
## E.g., LTO-generated name foo.llvm.123 should match foo.llvm.*.
-# CHECK: 4 out of {{.*}} functions in the binary {{.*}} have non-empty execution profile
+# CHECK: 6 out of {{.*}} functions in the binary {{.*}} have non-empty execution profile
# CHECK-NOT: profile for {{.*}} objects was ignored
.globl _start
@@ -27,6 +25,14 @@
# FDATA: 1 _start #LL_start_2# 1 foo.lto_priv.321 0 0 1
call foo.lto_priv.123
+LL_start_3:
+# FDATA: 1 _start #LL_start_3# 1 foo.__uniq.321 0 0 1
+ call foo.__uniq.123
+
+LL_start_4:
+# FDATA: 1 _start #LL_start_4# 1 foo.__uniq.654.llvm.321 0 0 1
+ call foo.__uniq.456.llvm.123
+
call exit
.size _start, .-_start
@@ -47,3 +53,15 @@
foo.lto_priv.123:
ret
.size foo.lto_priv.123, .-foo.lto_priv.123
+
+ .globl foo.__uniq.123
+ .type foo.__uniq.123, at function
+foo.__uniq.123:
+ ret
+ .size foo.__uniq.123, .-foo.__uniq.123
+
+ .globl foo.__uniq.456.llvm.123
+ .type foo.__uniq.456.llvm.123, at function
+foo.__uniq.456.llvm.123:
+ ret
+ .size foo.__uniq.456.llvm.123, .-foo.__uniq.456.llvm.123
Index: bolt/lib/Profile/DataReader.cpp
===================================================================
--- bolt/lib/Profile/DataReader.cpp
+++ bolt/lib/Profile/DataReader.cpp
@@ -42,13 +42,11 @@
namespace bolt {
std::optional<StringRef> getLTOCommonName(const StringRef Name) {
- size_t LTOSuffixPos = Name.find(".lto_priv.");
- if (LTOSuffixPos != StringRef::npos)
- return Name.substr(0, LTOSuffixPos + 10);
- if ((LTOSuffixPos = Name.find(".constprop.")) != StringRef::npos)
- return Name.substr(0, LTOSuffixPos + 11);
- if ((LTOSuffixPos = Name.find(".llvm.")) != StringRef::npos)
- return Name.substr(0, LTOSuffixPos + 6);
+ for (StringRef Suffix : {".__uniq.", ".lto_priv.", ".constprop.", ".llvm."}) {
+ size_t LTOSuffixPos = Name.find(Suffix);
+ if (LTOSuffixPos != StringRef::npos)
+ return Name.substr(0, LTOSuffixPos + Suffix.size());
+ }
return std::nullopt;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142073.491000.patch
Type: text/x-patch
Size: 2437 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230121/949bce20/attachment.bin>
More information about the llvm-commits
mailing list