[PATCH] D89617: Prepend "uniq" to symbol names hash with -funique-internal-linkage-names
Sriraman Tallam via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 17 09:47:40 PDT 2020
tmsriram updated this revision to Diff 298833.
tmsriram marked an inline comment as done.
tmsriram added a comment.
Prepend ".uniq." to the module name hash.
As mtrofin@ observerd, ".llvm." is prepended to the suffix of global names that are promoted from local in ModuleSummaryIndex and this is consistent with that.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89617/new/
https://reviews.llvm.org/D89617
Files:
clang/test/CodeGen/unique-internal-linkage-names.cpp
llvm/lib/Transforms/Utils/UniqueInternalLinkageNames.cpp
llvm/test/Transforms/UniqueInternalLinkageNames/unique_symbol_names.ll
Index: llvm/test/Transforms/UniqueInternalLinkageNames/unique_symbol_names.ll
===================================================================
--- llvm/test/Transforms/UniqueInternalLinkageNames/unique_symbol_names.ll
+++ llvm/test/Transforms/UniqueInternalLinkageNames/unique_symbol_names.ll
@@ -9,5 +9,5 @@
ret i32 0
}
-; CHECK: @glob.6ae72bb15a7d1834b42ae042a58f7a4d = internal global
-; CHECK: define internal i32 @foo.6ae72bb15a7d1834b42ae042a58f7a4d()
+; CHECK: @glob.uniq.6ae72bb15a7d1834b42ae042a58f7a4d = internal global
+; CHECK: define internal i32 @foo.uniq.6ae72bb15a7d1834b42ae042a58f7a4d()
Index: llvm/lib/Transforms/Utils/UniqueInternalLinkageNames.cpp
===================================================================
--- llvm/lib/Transforms/Utils/UniqueInternalLinkageNames.cpp
+++ llvm/lib/Transforms/Utils/UniqueInternalLinkageNames.cpp
@@ -27,7 +27,9 @@
Md5.final(R);
SmallString<32> Str;
llvm::MD5::stringifyResult(R, Str);
- std::string ModuleNameHash = (Twine(".") + Twine(Str)).str();
+ // Append "uniq" before the hash for tools like profilers to understand that
+ // this symbol is of internal linkage type.
+ std::string ModuleNameHash = (Twine(".uniq.") + Twine(Str)).str();
bool Changed = false;
// Append the module hash to all internal linkage functions.
Index: clang/test/CodeGen/unique-internal-linkage-names.cpp
===================================================================
--- clang/test/CodeGen/unique-internal-linkage-names.cpp
+++ clang/test/CodeGen/unique-internal-linkage-names.cpp
@@ -53,15 +53,15 @@
// PLAIN: define weak_odr i32 ()* @_ZL4mverv.resolver()
// PLAIN: define internal i32 @_ZL4mverv()
// PLAIN: define internal i32 @_ZL4mverv.sse4.2()
-// UNIQUE: @_ZL4glob.{{[0-9a-f]+}} = internal global
-// UNIQUE: @_ZZ8retAnonMvE5fGlob.{{[0-9a-f]+}} = internal global
-// UNIQUE: @_ZN12_GLOBAL__N_16anon_mE.{{[0-9a-f]+}} = internal global
-// UNIQUE: define internal i32 @_ZL3foov.{{[0-9a-f]+}}()
-// UNIQUE: define internal i32 @_ZN12_GLOBAL__N_14getMEv.{{[0-9a-f]+}}
+// UNIQUE: @_ZL4glob.uniq.{{[0-9a-f]+}} = internal global
+// UNIQUE: @_ZZ8retAnonMvE5fGlob.uniq.{{[0-9a-f]+}} = internal global
+// UNIQUE: @_ZN12_GLOBAL__N_16anon_mE.uniq.{{[0-9a-f]+}} = internal global
+// UNIQUE: define internal i32 @_ZL3foov.uniq.{{[0-9a-f]+}}()
+// UNIQUE: define internal i32 @_ZN12_GLOBAL__N_14getMEv.uniq.{{[0-9a-f]+}}
// UNIQUE: define weak_odr i32 ()* @_ZL4mverv.resolver()
-// UNIQUE: define internal i32 @_ZL4mverv.{{[0-9a-f]+}}()
-// UNIQUE: define internal i32 @_ZL4mverv.sse4.2.{{[0-9a-f]+}}
-// UNIQUEO1: define internal i32 @_ZL3foov.{{[0-9a-f]+}}()
+// UNIQUE: define internal i32 @_ZL4mverv.uniq.{{[0-9a-f]+}}()
+// UNIQUE: define internal i32 @_ZL4mverv.sse4.2.uniq.{{[0-9a-f]+}}
+// UNIQUEO1: define internal i32 @_ZL3foov.uniq.{{[0-9a-f]+}}()
// UNIQUEO1: define weak_odr i32 ()* @_ZL4mverv.resolver()
-// UNIQUEO1: define internal i32 @_ZL4mverv.{{[0-9a-f]+}}()
-// UNIQUEO1: define internal i32 @_ZL4mverv.sse4.2.{{[0-9a-f]+}}
+// UNIQUEO1: define internal i32 @_ZL4mverv.uniq.{{[0-9a-f]+}}()
+// UNIQUEO1: define internal i32 @_ZL4mverv.sse4.2.uniq.{{[0-9a-f]+}}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89617.298833.patch
Type: text/x-patch
Size: 3163 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201017/0d23950c/attachment.bin>
More information about the llvm-commits
mailing list