forked from OSchip/llvm-project
Remove superfluous copies in sample profiling.
No functionliaty change intended. llvm-svn: 321530
This commit is contained in:
parent
61085ca999
commit
24cb28bb54
|
@ -226,8 +226,8 @@ public:
|
||||||
|
|
||||||
sampleprof_error addCalledTargetSamples(uint32_t LineOffset,
|
sampleprof_error addCalledTargetSamples(uint32_t LineOffset,
|
||||||
uint32_t Discriminator,
|
uint32_t Discriminator,
|
||||||
const std::string &FName,
|
StringRef FName, uint64_t Num,
|
||||||
uint64_t Num, uint64_t Weight = 1) {
|
uint64_t Weight = 1) {
|
||||||
return BodySamples[LineLocation(LineOffset, Discriminator)].addCalledTarget(
|
return BodySamples[LineLocation(LineOffset, Discriminator)].addCalledTarget(
|
||||||
FName, Num, Weight);
|
FName, Num, Weight);
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,7 +628,7 @@ CoverageMapping::getInstantiationGroups(StringRef Filename) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<InstantiationGroup> Result;
|
std::vector<InstantiationGroup> Result;
|
||||||
for (const auto &InstantiationSet : InstantiationSetCollector) {
|
for (auto &InstantiationSet : InstantiationSetCollector) {
|
||||||
InstantiationGroup IG{InstantiationSet.first.first,
|
InstantiationGroup IG{InstantiationSet.first.first,
|
||||||
InstantiationSet.first.second,
|
InstantiationSet.first.second,
|
||||||
std::move(InstantiationSet.second)};
|
std::move(InstantiationSet.second)};
|
||||||
|
|
|
@ -181,8 +181,9 @@ public:
|
||||||
StringRef Name, bool IsThinLTOPreLink,
|
StringRef Name, bool IsThinLTOPreLink,
|
||||||
std::function<AssumptionCache &(Function &)> GetAssumptionCache,
|
std::function<AssumptionCache &(Function &)> GetAssumptionCache,
|
||||||
std::function<TargetTransformInfo &(Function &)> GetTargetTransformInfo)
|
std::function<TargetTransformInfo &(Function &)> GetTargetTransformInfo)
|
||||||
: GetAC(GetAssumptionCache), GetTTI(GetTargetTransformInfo),
|
: GetAC(std::move(GetAssumptionCache)),
|
||||||
Filename(Name), IsThinLTOPreLink(IsThinLTOPreLink) {}
|
GetTTI(std::move(GetTargetTransformInfo)), Filename(Name),
|
||||||
|
IsThinLTOPreLink(IsThinLTOPreLink) {}
|
||||||
|
|
||||||
bool doInitialization(Module &M);
|
bool doInitialization(Module &M);
|
||||||
bool runOnModule(Module &M, ModuleAnalysisManager *AM);
|
bool runOnModule(Module &M, ModuleAnalysisManager *AM);
|
||||||
|
@ -1547,14 +1548,14 @@ bool SampleProfileLoader::runOnModule(Module &M, ModuleAnalysisManager *AM) {
|
||||||
|
|
||||||
// Populate the symbol map.
|
// Populate the symbol map.
|
||||||
for (const auto &N_F : M.getValueSymbolTable()) {
|
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());
|
Function *F = dyn_cast<Function>(N_F.getValue());
|
||||||
if (F == nullptr)
|
if (F == nullptr)
|
||||||
continue;
|
continue;
|
||||||
SymbolMap[OrigName] = F;
|
SymbolMap[OrigName] = F;
|
||||||
auto pos = OrigName.find('.');
|
auto pos = OrigName.find('.');
|
||||||
if (pos != std::string::npos) {
|
if (pos != StringRef::npos) {
|
||||||
std::string NewName = OrigName.substr(0, pos);
|
StringRef NewName = OrigName.substr(0, pos);
|
||||||
auto r = SymbolMap.insert(std::make_pair(NewName, F));
|
auto r = SymbolMap.insert(std::make_pair(NewName, F));
|
||||||
// Failiing to insert means there is already an entry in SymbolMap,
|
// Failiing to insert means there is already an entry in SymbolMap,
|
||||||
// thus there are multiple functions that are mapped to the same
|
// thus there are multiple functions that are mapped to the same
|
||||||
|
|
Loading…
Reference in New Issue