[llvm] r321530 - Remove superfluous copies in sample profiling.
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 28 10:10:41 PST 2017
Author: d0k
Date: Thu Dec 28 10:10:41 2017
New Revision: 321530
URL: http://llvm.org/viewvc/llvm-project?rev=321530&view=rev
Log:
Remove superfluous copies in sample profiling.
No functionliaty change intended.
Modified:
llvm/trunk/include/llvm/ProfileData/SampleProf.h
llvm/trunk/lib/ProfileData/Coverage/CoverageMapping.cpp
llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp
Modified: llvm/trunk/include/llvm/ProfileData/SampleProf.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/SampleProf.h?rev=321530&r1=321529&r2=321530&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ProfileData/SampleProf.h (original)
+++ llvm/trunk/include/llvm/ProfileData/SampleProf.h Thu Dec 28 10:10:41 2017
@@ -226,8 +226,8 @@ public:
sampleprof_error addCalledTargetSamples(uint32_t LineOffset,
uint32_t Discriminator,
- const std::string &FName,
- uint64_t Num, uint64_t Weight = 1) {
+ StringRef FName, uint64_t Num,
+ uint64_t Weight = 1) {
return BodySamples[LineLocation(LineOffset, Discriminator)].addCalledTarget(
FName, Num, Weight);
}
Modified: llvm/trunk/lib/ProfileData/Coverage/CoverageMapping.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/Coverage/CoverageMapping.cpp?rev=321530&r1=321529&r2=321530&view=diff
==============================================================================
--- llvm/trunk/lib/ProfileData/Coverage/CoverageMapping.cpp (original)
+++ llvm/trunk/lib/ProfileData/Coverage/CoverageMapping.cpp Thu Dec 28 10:10:41 2017
@@ -628,7 +628,7 @@ CoverageMapping::getInstantiationGroups(
}
std::vector<InstantiationGroup> Result;
- for (const auto &InstantiationSet : InstantiationSetCollector) {
+ for (auto &InstantiationSet : InstantiationSetCollector) {
InstantiationGroup IG{InstantiationSet.first.first,
InstantiationSet.first.second,
std::move(InstantiationSet.second)};
Modified: llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp?rev=321530&r1=321529&r2=321530&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp Thu Dec 28 10:10:41 2017
@@ -181,8 +181,9 @@ public:
StringRef Name, bool IsThinLTOPreLink,
std::function<AssumptionCache &(Function &)> GetAssumptionCache,
std::function<TargetTransformInfo &(Function &)> GetTargetTransformInfo)
- : GetAC(GetAssumptionCache), GetTTI(GetTargetTransformInfo),
- Filename(Name), IsThinLTOPreLink(IsThinLTOPreLink) {}
+ : GetAC(std::move(GetAssumptionCache)),
+ GetTTI(std::move(GetTargetTransformInfo)), Filename(Name),
+ IsThinLTOPreLink(IsThinLTOPreLink) {}
bool doInitialization(Module &M);
bool runOnModule(Module &M, ModuleAnalysisManager *AM);
@@ -1547,14 +1548,14 @@ bool SampleProfileLoader::runOnModule(Mo
// Populate the symbol map.
for (const auto &N_F : M.getValueSymbolTable()) {
- std::string OrigName = N_F.getKey();
+ StringRef OrigName = N_F.getKey();
Function *F = dyn_cast<Function>(N_F.getValue());
if (F == nullptr)
continue;
SymbolMap[OrigName] = F;
auto pos = OrigName.find('.');
- if (pos != std::string::npos) {
- std::string NewName = OrigName.substr(0, pos);
+ if (pos != StringRef::npos) {
+ StringRef NewName = OrigName.substr(0, pos);
auto r = SymbolMap.insert(std::make_pair(NewName, F));
// Failiing to insert means there is already an entry in SymbolMap,
// thus there are multiple functions that are mapped to the same
More information about the llvm-commits
mailing list