[PATCH] D36813: [Coverage] Build sorted and unique segments

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 17 17:43:36 PDT 2017


vsk added inline comments.


================
Comment at: include/llvm/ProfileData/Coverage/CoverageMapping.h:201
 
+using LineColPair = std::pair<unsigned, unsigned>;
+
----------------
ikudrin wrote:
> I love this change! But maybe it deserves a separate patch?
I have split this change out (NFC) and rebased this patch on top of it (the new diff will still use LineColPair).


================
Comment at: unittests/ProfileData/CoverageMappingTest.cpp:566
+  EXPECT_EQ(CoverageSegment(3, 21, true), Segments[6]);
+  // Make sure to emit a skipped segment for the zero-length region at 3:21.
+  EXPECT_EQ(CoverageSegment(4, 4, false), Segments[7]);
----------------
ikudrin wrote:
> Could you remind me where zero-length regions like (3:21) might come from?
> Right now, it looks like the area from 3:21 to 4:4 has no counter associated with it, but I'd expect that a counter from the top-level region (1:5 - 4:4) was used here.
Zero-length regions can be emitted when we enter a macro expansion. And you're right, creating a segment at 3:21 with the count from 1:5 -> 4:4 would be more appropriate here. I will fix this.


https://reviews.llvm.org/D36813





More information about the llvm-commits mailing list