[PATCH] D18610: [Coverage] Restore the correct count value after processing a nested region in case of combined regions.
David Li via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 13 09:54:38 PDT 2016
davidxl added inline comments.
================
Comment at: llvm/trunk/lib/ProfileData/CoverageMapping.cpp:397
@@ +396,3 @@
+/// Combine counts of regions which cover the same area.
+template <class It> static It combineRegionCounts(It First, It Last) {
+ if (First == Last)
----------------
I think this can be simplified by calling std::unique
Followed by a scan of the duplicate entries. For each dup entry, call lower_bound to to find the matching entry and update it if it exists.
================
Comment at: llvm/trunk/lib/ProfileData/CoverageMapping.cpp:487
@@ -469,1 +486,3 @@
sortNestedRegions(Regions.begin(), Regions.end());
+ Regions.erase(combineRegionCounts(Regions.begin(), Regions.end()),
+ Regions.end());
----------------
This probably can be moved into 'sortNestedRegions'.
http://reviews.llvm.org/D18610
More information about the llvm-commits
mailing list