[llvm] [clang] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)

Teresa Johnson via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 5 08:41:08 PST 2023


================
@@ -300,12 +316,8 @@ getIRPGONameForGlobalObject(const GlobalObject &GO,
                             GlobalValue::LinkageTypes Linkage,
                             StringRef FileName) {
   SmallString<64> Name;
-  if (llvm::GlobalValue::isLocalLinkage(Linkage)) {
-    Name.append(FileName.empty() ? "<unknown>" : FileName);
-    Name.append(";");
-  }
   Mangler().getNameWithPrefix(Name, &GO, /*CannotUsePrivateLabel=*/true);
----------------
teresajohnson wrote:

> It wasn't broken in general, but it's needed to get -order_file working correctly.

Unfortunately this change broke aspects of ThinLTO ICP, however. Is it possible to change the handling of -order_file in the linker to modify the symbol names appropriately?

> To avoid subtle issues when linkage-name is different from mangled names,,I'm wondering if it warrants a change to use linkage-names (as opposed to mangled name) in GlobalValue::getGlobalIdentifier in this PR.

If the -order_name handling cannot be fixed as I suggested above, then yes, we need some solution to ensure that the hashed symbol names are consistent across PGO and ThinLTO.

https://github.com/llvm/llvm-project/pull/74008


More information about the cfe-commits mailing list