[PATCH] D87648: [Coverage][NFC] Remove skipped region after added into MappingRegions

Vedant Kumar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 18 14:18:11 PDT 2020


vsk added a comment.

Unfortunately it does look like the work done in gatherSkippedRegions is O(n^2) in the number of functions, at the moment. If the goal is to speed it up, it'd be good to grab some performance numbers for some representative compile unit (the sqlite3 amalgamation is my go-to for this sort of thing).



================
Comment at: clang/lib/CodeGen/CoverageMappingGen.cpp:353
+    SkippedRanges.erase(
+        std::remove_if(
+            SkippedRanges.begin(), SkippedRanges.end(),
----------------
In the worst case, the work done in gatherSkippedRegions may still be n + (n-1) + ... ~ O(n^2) (I'm subtracting 1 each time the skipped regions for a function are erased).


================
Comment at: clang/lib/CodeGen/CoverageMappingGen.cpp:356
+            [&](SkippedRange I) {
+              SourceRange Range = I.Range;
+              auto LocStart = Range.getBegin();
----------------
It'd probably be good to split the lambda out into a separate/named helper.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87648/new/

https://reviews.llvm.org/D87648



More information about the cfe-commits mailing list