[all-commits] [llvm/llvm-project] 397ac4: [Coverage] Introduce the type `CounterPair` for Re...

NAKAMURA Takumi via All-commits all-commits at lists.llvm.org
Thu Jan 9 00:11:29 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 397ac44f623f891d8f05d6673a95984ac0a26671
      https://github.com/llvm/llvm-project/commit/397ac44f623f891d8f05d6673a95984ac0a26671
  Author: NAKAMURA Takumi <geek4civic at gmail.com>
  Date:   2025-01-09 (Thu, 09 Jan 2025)

  Changed paths:
    M clang/lib/CodeGen/CGDecl.cpp
    M clang/lib/CodeGen/CGExpr.cpp
    M clang/lib/CodeGen/CGExprScalar.cpp
    M clang/lib/CodeGen/CGStmt.cpp
    M clang/lib/CodeGen/CodeGenFunction.cpp
    M clang/lib/CodeGen/CodeGenFunction.h
    M clang/lib/CodeGen/CodeGenModule.h
    M clang/lib/CodeGen/CodeGenPGO.cpp
    M clang/lib/CodeGen/CodeGenPGO.h
    M clang/lib/CodeGen/CoverageMappingGen.cpp
    M clang/lib/CodeGen/CoverageMappingGen.h

  Log Message:
  -----------
  [Coverage] Introduce the type `CounterPair` for RegionCounterMap. NFC. (#112724)

`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::Executed` is used.

Each counter number can have `None` to suppress emitting counter
increment. 2nd element `Skipped` is initialized as `None` by default,
since most `Stmt*` don't have a pair of counters.

This change also provides stubs for the verifier. 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 and 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



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list