[clang] [Coverage] Introduce `getBranchCounterPair()`. NFC. (PR #112702)
Jessica Paquette via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 18 00:59:44 PDT 2024
================
@@ -1804,9 +1832,10 @@ struct CounterCoverageMappingBuilder
Counter LoopCount =
addCounters(ParentCount, BackedgeCount, BC.ContinueCount);
- Counter OutCount =
- addCounters(BC.BreakCount, subtractCounters(LoopCount, BodyCount));
- if (OutCount != ParentCount) {
+ auto [ExecCount, ExitCount] = getBranchCounterPair(S, LoopCount);
+ assert(ExecCount.isZero() || ExecCount == BodyCount);
+ Counter OutCount = addCounters(BC.BreakCount, ExitCount);
----------------
ornata wrote:
this looks like it ought to be a helper function as well
https://github.com/llvm/llvm-project/pull/112702
More information about the cfe-commits
mailing list