[clang] [clang][coverage] Add opt-in call continuation counters for coverage (PR #201079)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 23 04:17:17 PDT 2026


================
@@ -36,6 +36,8 @@ class CodeGenPGO {
   unsigned NumRegionCounters;
   uint64_t FunctionHash;
   std::unique_ptr<llvm::DenseMap<const Stmt *, CounterPair>> RegionCounterMap;
+  std::unique_ptr<llvm::DenseMap<const Stmt *, unsigned>>
+      CallContinuationCounterMap;
----------------
ankurrj7 wrote:

 Thanks, I think I follow the point now.

  Let me think through this a bit more, but I agree the counter itself can probably live in
  RegionCounterMap. The continuation count is basically the executed count for the region that
  starts after the call returns, and there is not really a skipped side for that, so
  Skipped=None makes sense.

  My plan would be to try that shape: keep the same rules for deciding which calls get
  continuation counters, but store the assigned counter as a CounterPair in RegionCounterMap
  instead of carrying a separate counter map.

  The one detail I want to be careful about is that the current map is also acting as the
  .call continuation coverage is enabled? signal in a few coverage-mapping paths, especially
  where branch parent counts change after calls in conditions. If the counter map goes away, I
  think that should become an explicit bool rather than being inferred from the map.



https://github.com/llvm/llvm-project/pull/201079


More information about the cfe-commits mailing list