[PATCH] Coverage: improve efficiency of the counter propagation to the expansion regions.
Alex Lorenz
arphaman at gmail.com
Tue Jul 29 09:14:00 PDT 2014
Hi bogner, bob.wilson,
This patch reduces the complexity of the two inner loops in order to speed up the loading of coverage data for very large functions (>100kloc, >15k regions, >5k files).
http://reviews.llvm.org/D4708
Files:
lib/ProfileData/CoverageMappingReader.cpp
Index: lib/ProfileData/CoverageMappingReader.cpp
===================================================================
--- lib/ProfileData/CoverageMappingReader.cpp
+++ lib/ProfileData/CoverageMappingReader.cpp
@@ -251,15 +251,20 @@
// from the expanded file.
// Perform multiple passes to correctly propagate the counters through
// all the nested expansion regions.
+ SmallVector<CounterMappingRegion *, 8> ExpansionRegions;
for (unsigned Pass = 1, S = VirtualFileMapping.size(); Pass < S; ++Pass) {
- for (auto &I : MappingRegions) {
- if (I.Kind == CounterMappingRegion::ExpansionRegion) {
- for (const auto &J : MappingRegions) {
- if (J.FileID == I.ExpandedFileID) {
- I.Count = J.Count;
- break;
- }
- }
+ ExpansionRegions.clear();
+ ExpansionRegions.resize(VirtualFileMapping.size(), nullptr);
+ for (auto &R : MappingRegions) {
+ if (R.Kind != CounterMappingRegion::ExpansionRegion)
+ continue;
+ assert(!ExpansionRegions[R.ExpandedFileID]);
+ ExpansionRegions[R.ExpandedFileID] = &R;
+ }
+ for (auto &R : MappingRegions) {
+ if (ExpansionRegions[R.FileID]) {
+ ExpansionRegions[R.FileID]->Count = R.Count;
+ ExpansionRegions[R.FileID] = nullptr;
}
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4708.11985.patch
Type: text/x-patch
Size: 1306 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140729/2a6b98e6/attachment.bin>
More information about the llvm-commits
mailing list