aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR
diff options
context:
space:
mode:
authorMingming Liu <mingmingl@google.com>2023-12-18 09:39:55 -0800
committerGitHub <noreply@github.com>2023-12-18 09:39:55 -0800
commit3aa5d71127ae31f13cc3383ea461fd5bf86bf055 (patch)
tree50eda92e0b06e67027d0322c750cae5fd6787076 /llvm/lib/IR
parent3768039913be32666a316a2b5c12739c423dbc61 (diff)
downloadllvm-3aa5d71127ae31f13cc3383ea461fd5bf86bf055.zip
llvm-3aa5d71127ae31f13cc3383ea461fd5bf86bf055.tar.gz
llvm-3aa5d71127ae31f13cc3383ea461fd5bf86bf055.tar.bz2
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.
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/Globals.cpp12
1 files changed, 5 insertions, 7 deletions
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 += "<unknown>";
+ NewName = NewName.insert(0, "<unknown>:");
else
- GlobalName += FileName;
-
- GlobalName += kGlobalIdentifierDelimiter;
+ NewName = NewName.insert(0, FileName.str() + ":");
}
- GlobalName += Name;
- return GlobalName;
+ return NewName;
}
std::string GlobalValue::getGlobalIdentifier() const {