diff options
| author | Justin Bogner <mail@justinbogner.com> | 2014-12-02 23:15:30 +0000 |
|---|---|---|
| committer | Justin Bogner <mail@justinbogner.com> | 2014-12-02 23:15:30 +0000 |
| commit | 111c6533c202234a9085326fc237c03f7ca6f54f (patch) | |
| tree | 667296e2d885063cd9c432983d3da82e0185cfcd /clang/lib/CodeGen/CodeGenPGO.cpp | |
| parent | ec7ebebe558d42924784dc290d35284864d0088a (diff) | |
| download | bcm5719-llvm-111c6533c202234a9085326fc237c03f7ca6f54f.tar.gz bcm5719-llvm-111c6533c202234a9085326fc237c03f7ca6f54f.zip | |
InstrProf: Use the same names for variables as we use in the profile
There's no need to use different names for the local variables than we
use in the profile itself, and it's a bit simpler and easier to debug
if we're consistent.
llvm-svn: 223173
Diffstat (limited to 'clang/lib/CodeGen/CodeGenPGO.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CodeGenPGO.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/clang/lib/CodeGen/CodeGenPGO.cpp b/clang/lib/CodeGen/CodeGenPGO.cpp index 107b29c303e..38f21626e4e 100644 --- a/clang/lib/CodeGen/CodeGenPGO.cpp +++ b/clang/lib/CodeGen/CodeGenPGO.cpp @@ -27,7 +27,7 @@ using namespace CodeGen; void CodeGenPGO::setFuncName(StringRef Name, llvm::GlobalValue::LinkageTypes Linkage) { - RawFuncName = Name; + StringRef RawFuncName = Name; // Function names may be prefixed with a binary '1' to indicate // that the backend should not modify the symbols due to any platform @@ -35,20 +35,17 @@ void CodeGenPGO::setFuncName(StringRef Name, if (RawFuncName[0] == '\1') RawFuncName = RawFuncName.substr(1); - if (!llvm::GlobalValue::isLocalLinkage(Linkage)) { - PrefixedFuncName = RawFuncName; - return; + FuncName = RawFuncName; + 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 (CGM.getCodeGenOpts().MainFileName.empty()) + FuncName = FuncName.insert(0, "<unknown>:"); + else + FuncName = FuncName.insert(0, CGM.getCodeGenOpts().MainFileName + ":"); } - - // 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. - PrefixedFuncName = CGM.getCodeGenOpts().MainFileName; - if (PrefixedFuncName.empty()) - PrefixedFuncName.assign("<unknown>"); - PrefixedFuncName.append(":"); - PrefixedFuncName.append(RawFuncName); } void CodeGenPGO::setFuncName(llvm::Function *Fn) { |

