[PATCH] D56435: We can improve the performance (generally) by memo-izing the action to map a debug location to its function summary.
David Callahan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 8 11:20:30 PST 2019
david2050 updated this revision to Diff 180703.
david2050 added a comment.
use mutable keyword
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56435/new/
https://reviews.llvm.org/D56435
Files:
lib/Transforms/IPO/SampleProfile.cpp
Index: lib/Transforms/IPO/SampleProfile.cpp
===================================================================
--- lib/Transforms/IPO/SampleProfile.cpp
+++ lib/Transforms/IPO/SampleProfile.cpp
@@ -218,6 +218,7 @@
const FunctionSamples *findCalleeFunctionSamples(const Instruction &I) const;
std::vector<const FunctionSamples *>
findIndirectCallFunctionSamples(const Instruction &I, uint64_t &Sum) const;
+ mutable DenseMap<const DILocation *, const FunctionSamples *> DILocation2SampleMap;
const FunctionSamples *findFunctionSamples(const Instruction &I) const;
bool inlineCallInstruction(Instruction *I);
bool inlineHotFunctions(Function &F,
@@ -724,7 +725,12 @@
if (!DIL)
return Samples;
- return Samples->findFunctionSamples(DIL);
+ auto it = DILocation2SampleMap.find(DIL);
+ if (it != DILocation2SampleMap.end())
+ return it->second;
+ const FunctionSamples *s = Samples->findFunctionSamples(DIL);
+ DILocation2SampleMap.try_emplace(DIL, s);
+ return s;
}
bool SampleProfileLoader::inlineCallInstruction(Instruction *I) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56435.180703.patch
Type: text/x-patch
Size: 1070 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190108/66e8a250/attachment.bin>
More information about the llvm-commits
mailing list