From 3aa5d71127ae31f13cc3383ea461fd5bf86bf055 Mon Sep 17 00:00:00 2001 From: Mingming Liu Date: Mon, 18 Dec 2023 09:39:55 -0800 Subject: Revert "[PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles." (#75835) Reverts llvm/llvm-project#74008 The compiler-rt test failed due to `llvm-dis` not found (https://lab.llvm.org/buildbot/#/builders/127/builds/59884) Will revert and investigate how to require the proper dependency. --- llvm/lib/IR/Globals.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'llvm/lib/IR') diff --git a/llvm/lib/IR/Globals.cpp b/llvm/lib/IR/Globals.cpp index 239acd2..51bdbeb 100644 --- a/llvm/lib/IR/Globals.cpp +++ b/llvm/lib/IR/Globals.cpp @@ -144,27 +144,25 @@ void GlobalObject::copyAttributesFrom(const GlobalObject *Src) { std::string GlobalValue::getGlobalIdentifier(StringRef Name, GlobalValue::LinkageTypes Linkage, StringRef FileName) { + // Value names may be prefixed with a binary '1' to indicate // that the backend should not modify the symbols due to any platform // naming convention. Do not include that '1' in the PGO profile name. if (Name[0] == '\1') Name = Name.substr(1); - std::string GlobalName; + std::string NewName = std::string(Name); if (llvm::GlobalValue::isLocalLinkage(Linkage)) { // For local symbols, prepend the main file name to distinguish them. // Do not include the full path in the file name since there's no guarantee // that it will stay the same, e.g., if the files are checked out from // version control in different locations. if (FileName.empty()) - GlobalName += ""; + NewName = NewName.insert(0, ":"); else - GlobalName += FileName; - - GlobalName += kGlobalIdentifierDelimiter; + NewName = NewName.insert(0, FileName.str() + ":"); } - GlobalName += Name; - return GlobalName; + return NewName; } std::string GlobalValue::getGlobalIdentifier() const { -- cgit v1.1