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]+}} 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: 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()