diff options
author | Hiroshi Yamauchi <yamauchi@google.com> | 2018-09-07 18:00:58 +0000 |
---|---|---|
committer | Hiroshi Yamauchi <yamauchi@google.com> | 2018-09-07 18:00:58 +0000 |
commit | 5fb509b7638682a854605b19cb76b89eb4df7882 (patch) | |
tree | ddd39a34afd150b092d92a97658ab2242266bc15 /llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp | |
parent | d8bdf16cfe6d0e3b955a7d2f459b4c2b138156db (diff) | |
download | bcm5719-llvm-5fb509b7638682a854605b19cb76b89eb4df7882.tar.gz bcm5719-llvm-5fb509b7638682a854605b19cb76b89eb4df7882.zip |
[PGO][CHR] Small cleanup.
Summary:
Do away with demangling. It wasn't really necessary.
Declared some local functions to be static.
Reviewers: davidxl
Reviewed By: davidxl
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D51740
llvm-svn: 341681
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp')
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp | 53 |
1 files changed, 17 insertions, 36 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp b/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp index fab95cd3b4b..7b874c7507f 100644 --- a/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp +++ b/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp @@ -34,9 +34,6 @@ #include "llvm/Transforms/Utils/Cloning.h" #include "llvm/Transforms/Utils/ValueMapper.h" -#if !defined(_MSC_VER) -#include <cxxabi.h> -#endif #include <set> #include <sstream> @@ -160,12 +157,6 @@ struct CHRStats { // count at the scope entry. }; -inline raw_ostream LLVM_ATTRIBUTE_UNUSED &operator<<(raw_ostream &OS, - const CHRStats &Stats) { - Stats.print(OS); - return OS; -} - // RegInfo - some properties of a Region. struct RegInfo { RegInfo() : R(nullptr), HasBranch(false) {} @@ -326,11 +317,6 @@ class CHRScope { : RegInfos(RegInfosIn), Subs(SubsIn), BranchInsertPoint(nullptr) {} }; -inline raw_ostream &operator<<(raw_ostream &OS, const CHRScope &Scope) { - Scope.print(OS); - return OS; -} - class CHR { public: CHR(Function &Fin, BlockFrequencyInfo &BFIin, DominatorTree &DTin, @@ -437,6 +423,19 @@ class CHR { } // end anonymous namespace +static inline +raw_ostream LLVM_ATTRIBUTE_UNUSED &operator<<(raw_ostream &OS, + const CHRStats &Stats) { + Stats.print(OS); + return OS; +} + +static inline +raw_ostream &operator<<(raw_ostream &OS, const CHRScope &Scope) { + Scope.print(OS); + return OS; +} + static bool shouldApply(Function &F, ProfileSummaryInfo& PSI) { if (ForceCHR) return true; @@ -444,16 +443,7 @@ static bool shouldApply(Function &F, ProfileSummaryInfo& PSI) { if (!CHRModuleList.empty() || !CHRFunctionList.empty()) { if (CHRModules.count(F.getParent()->getName())) return true; - StringRef Name = F.getName(); - if (CHRFunctions.count(Name)) - return true; - const char* DemangledName = nullptr; -#if !defined(_MSC_VER) - int Status = -1; - DemangledName = abi::__cxa_demangle(Name.str().c_str(), - nullptr, nullptr, &Status); -#endif - return DemangledName && CHRFunctions.count(DemangledName); + return CHRFunctions.count(F.getName()); } assert(PSI.hasProfileSummary() && "Empty PSI?"); @@ -462,19 +452,10 @@ static bool shouldApply(Function &F, ProfileSummaryInfo& PSI) { static void LLVM_ATTRIBUTE_UNUSED dumpIR(Function &F, const char *Label, CHRStats *Stats) { - std::string Name = F.getName().str(); - const char *DemangledName = nullptr; -#if !defined(_MSC_VER) - int Status = -1; - DemangledName = abi::__cxa_demangle(Name.c_str(), - nullptr, nullptr, &Status); -#endif - if (DemangledName == nullptr) { - DemangledName = "<NOT-MANGLED>"; - } - std::string ModuleName = F.getParent()->getName().str(); + StringRef FuncName = F.getName(); + StringRef ModuleName = F.getParent()->getName(); CHR_DEBUG(dbgs() << "CHR IR dump " << Label << " " << ModuleName << " " - << Name); + << FuncName); if (Stats) CHR_DEBUG(dbgs() << " " << *Stats); CHR_DEBUG(dbgs() << "\n"); |