Skip to content

Conversation

@chapuni
Copy link
Contributor

@chapuni chapuni commented Oct 21, 2024

https://discourse.llvm.org/t/rfc-integrating-singlebytecoverage-with-branch-coverage/82492

This is squashed view of my requests.

Preparations

Practical changes

Other requests (not here)

chapuni added 29 commits October 3, 2024 15:47
`SingleByteCoverage` is not per-region attribute at least. At the moment, this change moves it into `FunctionRecord`.
- Round `Counts` as 1/0 - Confirm both `ExecutionCount` and `AltExecutionCount` are in range.
This return a counter for each term in the expression replaced by ReplaceMap. At the moment, this doesn't update the Map, so Map is marked as `const`.
This aggregates the generation of branch counter pair as `ExecCnt` and `SkipCnt`, to aggregate `CounterExpr::subtract`. At the moment: - This change preserves the behavior of `llvm::EnableSingleByteCoverage`. Almost of SingleByteCoverage will be cleaned up by coming commits. - `getBranchCounterPair()` is not called in `llvm::EnableSingleByteCoverage`. I will implement the new behavior of SingleByteCoverage in it. - `IsCounterEqual(Out, Par)` is introduced instead of `Counter::operator==`. Tweaks would be required for the comparison for additional counters. - Braces around `assert()` is intentional. I will add a statement there. https://discourse.llvm.org/t/rfc-integrating-singlebytecoverage-with-branch-coverage/82492
`CounterPair` can hold `<uint32_t, uint32_t>` instead of current `unsigned`, to hold also the counter number of SkipPath. For now, this change provides the skeleton and only `CounterPair::first` is used. Each counter number can have `None` to suppress emitting counter increment. `second` is initialized as `None` by default, since most `Stmt*` don't have a pair of counters. This change also provides stubs for the verifyer. I'll provide the impl of verifier for `+Asserts` later. `markStmtAsUsed(bool, Stmt*)` may be used to inform that other side counter may not emitted. `markStmtMaybeUsed(S)` may be used for the `Stmt` and its inner will be excluded for emission in the case of skipping by constant folding. I put it into places where I found. `verifyCounterMap()` will check the coverage map the counter map and can be used to report inconsistency. These verifier methods shall be eliminated in `-Asserts`. https://discourse.llvm.org/t/rfc-integrating-singlebytecoverage-with-branch-coverage/82492
…/single/replace' and 'users/chapuni/cov/single/pair' into HEAD
`getBranchCounterPair()` allocates an additional Counter to SkipPath in `SingleByteCoverage`. `IsCounterEqual()` calculates the comparison with rewinding counter replacements. `NumRegionCounters` is updated to take additional counters in account. `incrementProfileCounter()` has a few additiona arguments. - `UseSkipPath=true`, to specify setting counters for SkipPath. It assumes `UseSkipPath=false` is used together. - `UseBoth` may be specified for marking another path. It introduces the same effect as issueing `markStmtAsUsed(!SkipPath, S)`. `llvm-cov` discovers counters in `FalseCount` to allocate `MaxCounterID` for empty profile data.
…cov/single/replace' into users/chapuni/cov/single/nextcount-base
Currently `first` is not None by default.
…/single/nextcount' into users/chapuni/cov/single/base
…ngle/condop' and 'users/chapuni/cov/single/if' into users/chapuni/cov/single/binop-base
…ingle/binop' and 'users/chapuni/cov/single/switch' into HEAD
chapuni added 30 commits January 8, 2025 10:32
…ingle/binop-base Conflicts:	clang/lib/CodeGen/CoverageMappingGen.cpp
…ngle/condop' and 'users/chapuni/cov/single/if' into users/chapuni/cov/single/binop-base
…ingle/loop Conflicts:	clang/lib/CodeGen/CoverageMappingGen.cpp
…ingle/condop Conflicts:	clang/lib/CodeGen/CoverageMappingGen.cpp
…ingle/if Conflicts:	clang/lib/CodeGen/CoverageMappingGen.cpp
…ngle/condop' and 'users/chapuni/cov/single/if' into users/chapuni/cov/single/binop-base
…single/trunk Conflicts:	clang/lib/CodeGen/CoverageMappingGen.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants