[all-commits] [llvm/llvm-project] ea3e2d: [Coverage] Introduce "partial fold" on BranchRegion

NAKAMURA Takumi via All-commits all-commits at lists.llvm.org
Thu Oct 17 04:38:28 PDT 2024


  Branch: refs/heads/users/chapuni/cov/single/partial
  Home:   https://github.com/llvm/llvm-project
  Commit: ea3e2df8c712ae5da77e55a14e97b1b6855a6b76
      https://github.com/llvm/llvm-project/commit/ea3e2df8c712ae5da77e55a14e97b1b6855a6b76
  Author: NAKAMURA Takumi <geek4civic at gmail.com>
  Date:   2024-10-17 (Thu, 17 Oct 2024)

  Changed paths:
    M clang/lib/CodeGen/CoverageMappingGen.cpp
    M clang/test/CoverageMapping/branch-constfolded.cpp
    M clang/test/CoverageMapping/if.cpp
    M clang/test/CoverageMapping/macro-expansion.c
    M clang/test/CoverageMapping/mcdc-scratch-space.c
    M clang/test/CoverageMapping/mcdc-system-headers.cpp
    M clang/test/CoverageMapping/switch.cpp
    M clang/test/CoverageMapping/switchmacro.c
    M llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
    M llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
    M llvm/test/tools/llvm-cov/branch-c-general.test
    M llvm/tools/llvm-cov/CoverageExporterJson.cpp
    M llvm/tools/llvm-cov/CoverageExporterLcov.cpp
    M llvm/tools/llvm-cov/CoverageSummaryInfo.cpp
    M llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
    M llvm/tools/llvm-cov/SourceCoverageViewText.cpp

  Log Message:
  -----------
  [Coverage] Introduce "partial fold" on BranchRegion

Currently both True/False counts were folded. It lost the information,
"It is True or False before folding." It prevented recalling branch
counts in merging template instantiations.

In `llvm-cov`, a folded branch is shown as:

- `[True: n, Folded]`
- `[Folded, False n]`

In the case If `n` is zero, a branch is reported as "uncovered". This
is distinguished from "folded" branch. When folded branches are
merged, `Folded` may be dissolved.

In the coverage map, either `Counter` is `Zero`. Currently both were
`Zero`.

Since "partial fold" has been introduced, either case in `switch` is
omitted as `Folded`.

Each `case:` in `switch` is reported as `[True: n, Folded]`, since
`False` count doesn't show meaningful value.

When `switch` doesn't have `default:`, `switch (Cond)` is reported as
`[Folded, False: n]`, since `True` count was just the sum of
`case`(s). `switch` with `default` can be considered as "the statement
that doesn't have any `False`(s)".



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