diff options
author | Xinliang David Li <davidxl@google.com> | 2015-12-11 19:53:19 +0000 |
---|---|---|
committer | Xinliang David Li <davidxl@google.com> | 2015-12-11 19:53:19 +0000 |
commit | c79283ef2912095de447295c0b49916cf2504ad0 (patch) | |
tree | e1810ebfa38f87f46c1dd099f8b5259ae466d285 /llvm/lib/ProfileData/InstrProf.cpp | |
parent | e2ccd33359327b83fd183de4de8331735088b063 (diff) | |
download | bcm5719-llvm-c79283ef2912095de447295c0b49916cf2504ad0.tar.gz bcm5719-llvm-c79283ef2912095de447295c0b49916cf2504ad0.zip |
[PGO] Stop using invalid char in instr variable names.
Before the patch, -fprofile-instr-generate compile will fail
if no integrated-as is specified when the file contains
any static functions (the -S output is also invalid).
This patch fixed the issue. With the change, the index format
version will be bumped up by 1. Backward compatibility is
preserved with this change.
Differential Revision: http://reviews.llvm.org/D15243
llvm-svn: 255365
Diffstat (limited to 'llvm/lib/ProfileData/InstrProf.cpp')
-rw-r--r-- | llvm/lib/ProfileData/InstrProf.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/ProfileData/InstrProf.cpp b/llvm/lib/ProfileData/InstrProf.cpp index a965a1208b5..2608847fd10 100644 --- a/llvm/lib/ProfileData/InstrProf.cpp +++ b/llvm/lib/ProfileData/InstrProf.cpp @@ -74,14 +74,15 @@ namespace llvm { std::string getPGOFuncName(StringRef RawFuncName, GlobalValue::LinkageTypes Linkage, - StringRef FileName, - uint64_t Version LLVM_ATTRIBUTE_UNUSED) { + StringRef FileName, uint64_t Version) { // Function 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 (RawFuncName[0] == '\1') RawFuncName = RawFuncName.substr(1); + const char *Unknown = (Version <= 3 ? "<unknown>:" : "__unknown__"); + const char *Sep = (Version <= 3 ? ":" : "__"); std::string FuncName = RawFuncName; if (llvm::GlobalValue::isLocalLinkage(Linkage)) { @@ -90,9 +91,9 @@ std::string getPGOFuncName(StringRef RawFuncName, // that it will stay the same, e.g., if the files are checked out from // version control in different locations. if (FileName.empty()) - FuncName = FuncName.insert(0, "<unknown>:"); + FuncName = FuncName.insert(0, Unknown); else - FuncName = FuncName.insert(0, FileName.str() + ":"); + FuncName = FuncName.insert(0, FileName.str() + Sep); } return FuncName; } |