[all-commits] [llvm/llvm-project] 4a011a: [Coverage] Introduce "partial fold" on BranchRegio...

NAKAMURA Takumi via All-commits all-commits at lists.llvm.org
Sat Oct 19 20:30:56 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4a011ac84fa16f7eed34c309bdac5591d9553da7
      https://github.com/llvm/llvm-project/commit/4a011ac84fa16f7eed34c309bdac5591d9553da7
  Author: NAKAMURA Takumi <geek4civic at gmail.com>
  Date:   2024-10-20 (Sun, 20 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 (#112694)

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