[llvm-branch-commits] [clang] [llvm] [Coverage] Make additional counters available for BranchRegion. NFC. (PR #120930)

NAKAMURA Takumi via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Jan 5 19:32:19 PST 2025


================
@@ -940,15 +939,35 @@ struct CounterCoverageMappingBuilder
 
   std::pair<Counter, Counter> getBranchCounterPair(const Stmt *S,
                                                    Counter ParentCnt) {
-    Counter ExecCnt = getRegionCounter(S);
-    return {ExecCnt, Builder.subtract(ParentCnt, ExecCnt)};
+    auto &TheMap = CounterMap[S];
+    auto ExecCnt = Counter::getCounter(TheMap.first);
----------------
chapuni wrote:

I guess it assumes `S` always hit. The logic is similar to the current implementation.

`TheMap` will be allocated with an initial value if `S` doesn't hit. We can introduce more strict checks.

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


More information about the llvm-branch-commits mailing list