History log of /llvm-project/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp (Results 1 – 25 of 105)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5
# 4f1b20f0 20-Nov-2024 Kazu Hirata <kazu@google.com>

[ProfileData] Remove unused includes (NFC) (#116751)

Identified with misc-include-cleaner.


Revision tags: llvmorg-19.1.4, llvmorg-19.1.3
# bf8f5cc9 24-Oct-2024 Yuta Saito <kateinoigakukun@gmail.com>

Reland: [llvm-cov][WebAssembly] Read `__llvm_prf_names` from data segments (#112569)

On WebAssembly, most coverage metadata contents read by llvm-cov (like
`__llvm_covmap` and `__llvm_covfun`) are

Reland: [llvm-cov][WebAssembly] Read `__llvm_prf_names` from data segments (#112569)

On WebAssembly, most coverage metadata contents read by llvm-cov (like
`__llvm_covmap` and `__llvm_covfun`) are stored in custom sections
because they are not referenced at runtime. However, `__llvm_prf_names`
is referenced at runtime by the profile runtime library and is read by
llvm-cov post-processing tools, so it needs to be stored in a data
segment, which is allocatable at runtime and accessible by tools as long
as "name" section is present in the binary.

This patch changes the way llvm-cov reads `__llvm_prf_names` on
WebAssembly. Instead of looking for a section, it looks for a data
segment with the same name.

This reverts commit 157f10ddf2d851125a85a71e530dc9d50cb032a2 and fixes
PE/COFF `.lprfn$A` section handling.

show more ...


# 157f10dd 16-Oct-2024 Yuta Saito <kateinoigakukun@gmail.com>

Revert "[llvm-cov][WebAssembly] Read `__llvm_prf_names` from data segments" (#112520)

This reverts commit efc9dd4118a7ada7d8c898582f16db64827f7ce0 in order to
fix Windows test failure:
https://git

Revert "[llvm-cov][WebAssembly] Read `__llvm_prf_names` from data segments" (#112520)

This reverts commit efc9dd4118a7ada7d8c898582f16db64827f7ce0 in order to
fix Windows test failure:
https://github.com/llvm/llvm-project/pull/111332#issuecomment-2416462512

show more ...


Revision tags: llvmorg-19.1.2
# d4efc3e0 14-Oct-2024 Yuta Saito <kateinoigakukun@gmail.com>

[Coverage][WebAssembly] Add initial support for WebAssembly/WASI (#111332)

Currently, WebAssembly/WASI target does not provide direct support for
code coverage.
This patch set fixes several issues

[Coverage][WebAssembly] Add initial support for WebAssembly/WASI (#111332)

Currently, WebAssembly/WASI target does not provide direct support for
code coverage.
This patch set fixes several issues to unlock the feature. The main
changes are:

1. Port `compiler-rt/lib/profile` to WebAssembly/WASI.
2. Adjust profile metadata sections for Wasm object file format.
- [CodeGen] Emit `__llvm_covmap` and `__llvm_covfun` as custom sections
instead of data segments.
- [lld] Align the interval space of custom sections at link time.
- [llvm-cov] Copy misaligned custom section data if the start address is
not aligned.
- [llvm-cov] Read `__llvm_prf_names` from data segments
3. [clang] Link with profile runtime libraries if requested

See each commit message for more details and rationale.
This is part of the effort to add code coverage support in Wasm target
of Swift toolchain.

show more ...


Revision tags: llvmorg-19.1.1, llvmorg-19.1.0
# 536bdc99 13-Sep-2024 gulfemsavrun <gulfem@google.com>

[Coverage] Skip empty profile name section (#108480)

llvm-cov reads __llvm_prf_names section in an object file to find the
profile names, and it instead reads __llvm_covnames section in binary
pro

[Coverage] Skip empty profile name section (#108480)

llvm-cov reads __llvm_prf_names section in an object file to find the
profile names, and it instead reads __llvm_covnames section in binary
profile correlation mode when __llvm_prf_names section is omitted. This
patch ensures that it still reads __llvm_covnames section when there is
an empty __llvm_prf_names section.

show more ...


Revision tags: llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3
# 2c7610cc 28-Mar-2024 Mingming Liu <mingmingl@google.com>

[nfc]Make InstrProfSymtab non-copyable and non-movable (#86882)

- The direct use case (in [1]) is to add `llvm::IntervalMap` [2] and the allocator required by IntervalMap ctor [3]
to class `Ins

[nfc]Make InstrProfSymtab non-copyable and non-movable (#86882)

- The direct use case (in [1]) is to add `llvm::IntervalMap` [2] and the allocator required by IntervalMap ctor [3]
to class `InstrProfSymtab` as owned members. The allocator class doesn't have a move-assignment operator;
and it's going to take much effort to implement move-assignment operator for the allocator class such that the
enclosing class is movable.
- There is only one use of compiler-generated move-assignment operator in the repo, which is in
CoverageMappingReader.cpp. Luckily it's possible to use std::unique_ptr<InstrProfSymtab> instead, so did the change.

[1] https://github.com/llvm/llvm-project/pull/66825
[2] https://github.com/llvm/llvm-project/blob/4c2f68840e984b0f111779c46845ac00e3a7547d/llvm/include/llvm/ADT/IntervalMap.h#L936
[3] https://github.com/llvm/llvm-project/blob/4c2f68840e984b0f111779c46845ac00e3a7547d/llvm/include/llvm/ADT/IntervalMap.h#L1041

show more ...


Revision tags: llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3
# ab76e48a 15-Feb-2024 NAKAMURA Takumi <geek4civic@gmail.com>

[MC/DC] Refactor: Let MCDCConditionID int16_t with zero-origin (#81257)

Also, Let `NumConditions` `uint16_t`.

It is smarter to handle the ID as signed.
Narrowing to `int16_t` will reduce costs o

[MC/DC] Refactor: Let MCDCConditionID int16_t with zero-origin (#81257)

Also, Let `NumConditions` `uint16_t`.

It is smarter to handle the ID as signed.
Narrowing to `int16_t` will reduce costs of handling byvalue. (See also
#81221 and #81227)

External behavior doesn't change. They below handle values as internal
values plus 1.
* `-dump-coverage-mapping`
* `CoverageMappingReader.cpp`
* `CoverageMappingWriter.cpp`

show more ...


# 1a1fcacb 14-Feb-2024 NAKAMURA Takumi <geek4civic@gmail.com>

[MC/DC] Refactor: Introduce `ConditionIDs` as `std::array<2>` (#81221)

Its 0th element corresponds to `FalseID` and 1st to `TrueID`.

CoverageMappingGen.cpp: `DecisionIDPair` is replaced with `Con

[MC/DC] Refactor: Introduce `ConditionIDs` as `std::array<2>` (#81221)

Its 0th element corresponds to `FalseID` and 1st to `TrueID`.

CoverageMappingGen.cpp: `DecisionIDPair` is replaced with `ConditionIDs`

show more ...


# a17a3e9d 13-Feb-2024 NAKAMURA Takumi <geek4civic@gmail.com>

[MC/DC] Refactor: Make `MCDCParams` as `std::variant` (#81227)

Introduce `mcdc::DecisionParameters` and `mcdc::BranchParameters` and make
sure them not initialized as zero.

FIXME: Could we make

[MC/DC] Refactor: Make `MCDCParams` as `std::variant` (#81227)

Introduce `mcdc::DecisionParameters` and `mcdc::BranchParameters` and make
sure them not initialized as zero.

FIXME: Could we make `CoverageMappingRegion` as a smart tagged union?

show more ...


# 4588525d 12-Feb-2024 NAKAMURA Takumi <geek4civic@gmail.com>

CoverageMappingReader/Writer: MCDCConditionID shouldn't be zero


# f0db35b9 13-Feb-2024 NAKAMURA Takumi <geek4civic@gmail.com>

[MC/DC] Refactor: Introduce `MCDCTypes.h` for `coverage::mcdc` (#81459)

They can be also used in `clang`.
Introduce the lightweight header instead of `CoverageMapping.h`.

This includes for now:

[MC/DC] Refactor: Introduce `MCDCTypes.h` for `coverage::mcdc` (#81459)

They can be also used in `clang`.
Introduce the lightweight header instead of `CoverageMapping.h`.

This includes for now:
* `mcdc::ConditionID`
* `mcdc::Parameters`

show more ...


Revision tags: llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init
# ab3430f8 14-Dec-2023 Zequan Wu <zequanwu@google.com>

[Profile] Add binary profile correlation for code coverage. (#69493)

## Motivation
Since we don't need the metadata sections at runtime, we can somehow
offload them from memory at runtime. Initial

[Profile] Add binary profile correlation for code coverage. (#69493)

## Motivation
Since we don't need the metadata sections at runtime, we can somehow
offload them from memory at runtime. Initially, I explored [debug info
correlation](https://discourse.llvm.org/t/instrprofiling-lightweight-instrumentation/59113),
which is used for PGO with value profiling disabled. However, it
currently only works with DWARF and it's be hard to add such artificial
debug info for every function in to CodeView which is used on Windows.
So, offloading profile metadata sections at runtime seems to be a
platform independent option.

## Design
The idea is to use new section names for profile name and data sections
and mark them as metadata sections. Under this mode, the new sections
are non-SHF_ALLOC in ELF. So, they are not loaded into memory at runtime
and can be stripped away as a post-linking step. After the process
exits, the generated raw profiles will contains only headers + counters.
llvm-profdata can be used correlate raw profiles with the unstripped
binary to generate indexed profile.

## Data
For chromium base_unittests with code coverage on linux, the binary size
overhead due to instrumentation reduced from 64M to 38.8M (39.4%) and
the raw profile files size reduce from 128M to 68M (46.9%)
```
$ bloaty out/cov/base_unittests.stripped -- out/no-cov/base_unittests.stripped
FILE SIZE VM SIZE
-------------- --------------
+121% +30.4Mi +121% +30.4Mi .text
[NEW] +14.6Mi [NEW] +14.6Mi __llvm_prf_data
[NEW] +10.6Mi [NEW] +10.6Mi __llvm_prf_names
[NEW] +5.86Mi [NEW] +5.86Mi __llvm_prf_cnts
+95% +1.75Mi +95% +1.75Mi .eh_frame
+108% +400Ki +108% +400Ki .eh_frame_hdr
+9.5% +211Ki +9.5% +211Ki .rela.dyn
+9.2% +95.0Ki +9.2% +95.0Ki .data.rel.ro
+5.0% +87.3Ki +5.0% +87.3Ki .rodata
[ = ] 0 +13% +47.0Ki .bss
+40% +1.78Ki +40% +1.78Ki .got
+12% +1.49Ki +12% +1.49Ki .gcc_except_table
[ = ] 0 +65% +1.23Ki .relro_padding
+62% +1.20Ki [ = ] 0 [Unmapped]
+13% +448 +19% +448 .init_array
+8.8% +192 [ = ] 0 [ELF Section Headers]
+0.0% +136 +0.0% +80 [7 Others]
+0.1% +96 +0.1% +96 .dynsym
+1.2% +96 +1.2% +96 .rela.plt
+1.5% +80 +1.2% +64 .plt
[ = ] 0 -99.2% -3.68Ki [LOAD #5 [RW]]
+195% +64.0Mi +194% +64.0Mi TOTAL
$ bloaty out/cov-cor/base_unittests.stripped -- out/no-cov/base_unittests.stripped
FILE SIZE VM SIZE
-------------- --------------
+121% +30.4Mi +121% +30.4Mi .text
[NEW] +5.86Mi [NEW] +5.86Mi __llvm_prf_cnts
+95% +1.75Mi +95% +1.75Mi .eh_frame
+108% +400Ki +108% +400Ki .eh_frame_hdr
+9.5% +211Ki +9.5% +211Ki .rela.dyn
+9.2% +95.0Ki +9.2% +95.0Ki .data.rel.ro
+5.0% +87.3Ki +5.0% +87.3Ki .rodata
[ = ] 0 +13% +47.0Ki .bss
+40% +1.78Ki +40% +1.78Ki .got
+12% +1.49Ki +12% +1.49Ki .gcc_except_table
+13% +448 +19% +448 .init_array
+0.1% +96 +0.1% +96 .dynsym
+1.2% +96 +1.2% +96 .rela.plt
+1.2% +64 +1.2% +64 .plt
+2.9% +64 [ = ] 0 [ELF Section Headers]
+0.0% +40 +0.0% +40 .data
+1.2% +32 +1.2% +32 .got.plt
+0.0% +24 +0.0% +8 [5 Others]
[ = ] 0 -22.9% -872 [LOAD #5 [RW]]
-74.5% -1.44Ki [ = ] 0 [Unmapped]
[ = ] 0 -76.5% -1.45Ki .relro_padding
+118% +38.8Mi +117% +38.8Mi TOTAL
```

A few things to note:
1. llvm-profdata doesn't support filter raw profiles by binary id yet,
so when a raw profile doesn't belongs to the binary being digested by
llvm-profdata, merging will fail. Once this is implemented,
llvm-profdata should be able to only merge raw profiles with the same
binary id as the binary and discard the rest (with mismatched/missing
binary id). The workflow I have in mind is to have scripts invoke
llvm-profdata to get all binary ids for all raw profiles, and
selectively choose the raw pnrofiles with matching binary id and the
binary to llvm-profdata for merging.
2. Note: In COFF, currently they are still loaded into memory but not
used. I didn't do it in this patch because I noticed that `.lcovmap` and
`.lcovfunc` are loaded into memory. A separate patch will address it.
3. This should works with PGO when value profiling is disabled as debug
info correlation currently doing, though I haven't tested this yet.

show more ...


# 8ecbb040 13-Dec-2023 Alan Phipps <a-phipps@ti.com>

Reland "[Coverage][llvm-cov] Enable MC/DC Support in LLVM Source-based Code Coverage (2/3)"

Part 2 of 3. This includes the Visualization and Evaluation components.

Differential Revision: https://re

Reland "[Coverage][llvm-cov] Enable MC/DC Support in LLVM Source-based Code Coverage (2/3)"

Part 2 of 3. This includes the Visualization and Evaluation components.

Differential Revision: https://reviews.llvm.org/D138847

show more ...


Revision tags: llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2
# f95b2f1a 21-Sep-2023 Alan Phipps <a-phipps@ti.com>

Reland "[InstrProf][compiler-rt] Enable MC/DC Support in LLVM Source-based Code Coverage (1/3)"

Part 1 of 3. This includes the LLVM back-end processing and profile
reading/writing components. compil

Reland "[InstrProf][compiler-rt] Enable MC/DC Support in LLVM Source-based Code Coverage (1/3)"

Part 1 of 3. This includes the LLVM back-end processing and profile
reading/writing components. compiler-rt changes are included.

Differential Revision: https://reviews.llvm.org/D138846

show more ...


# a9d50568 11-Oct-2023 Kazu Hirata <kazu@google.com>

Use llvm::endianness (NFC)

Now that llvm::support::endianness has been renamed to
llvm::endianness, we can use the shorter form. This patch replaces
support::endianness with llvm::endianness.


# b05dbc4d 11-Oct-2023 Kazu Hirata <kazu@google.com>

[llvm] Use llvm::endianness::{big,little,native} (NFC)

Now that llvm::support::endianness has been renamed to
llvm::endianness, we can use the shorter form. This patch replaces
support::endianness:

[llvm] Use llvm::endianness::{big,little,native} (NFC)

Now that llvm::support::endianness has been renamed to
llvm::endianness, we can use the shorter form. This patch replaces
support::endianness::{big,little,native} with
llvm::endianness::{big,little,native}.

show more ...


# 4d5d9a53 27-Sep-2023 Zequan Wu <zequanwu@google.com>

Revert "[Coverage] Allow Clang coverage to be used with debug info correlation."

This reverts commit 32db121b29f78e4c41116b2a8f1c730f9522b202 and subsequent commits.

This causes time regression on

Revert "[Coverage] Allow Clang coverage to be used with debug info correlation."

This reverts commit 32db121b29f78e4c41116b2a8f1c730f9522b202 and subsequent commits.

This causes time regression on llvm-cov even with debug info correlation off.

show more ...


# 53a2923b 21-Sep-2023 Hans Wennborg <hans@chromium.org>

Revert "[InstrProf][compiler-rt] Enable MC/DC Support in LLVM Source-based Code Coverage (1/3)"

This seems to cause Clang to crash, see comments on the code review. Reverting
until the problem can b

Revert "[InstrProf][compiler-rt] Enable MC/DC Support in LLVM Source-based Code Coverage (1/3)"

This seems to cause Clang to crash, see comments on the code review. Reverting
until the problem can be investigated.

> Part 1 of 3. This includes the LLVM back-end processing and profile
> reading/writing components. compiler-rt changes are included.
>
> Differential Revision: https://reviews.llvm.org/D138846

This reverts commit a50486fd736ab2fe03fcacaf8b98876db77217a7.

show more ...


# ab3cd075 20-Sep-2023 Alan Phipps <a-phipps@ti.com>

Revert "[Coverage][llvm-cov] Enable MC/DC Support in LLVM Source-based Code Coverage (2/3)"

This reverts commit 618a22144db5e45da8c95dc22064103e1b5e5b71.

Buildbots failing on windows and one other

Revert "[Coverage][llvm-cov] Enable MC/DC Support in LLVM Source-based Code Coverage (2/3)"

This reverts commit 618a22144db5e45da8c95dc22064103e1b5e5b71.

Buildbots failing on windows and one other issue.

show more ...


Revision tags: llvmorg-17.0.1
# 618a2214 18-Sep-2023 Alan Phipps <a-phipps@ti.com>

[Coverage][llvm-cov] Enable MC/DC Support in LLVM Source-based Code Coverage (2/3)

Part 2 of 3. This includes the Visualization and Evaluation components.

Differential Revision: https://reviews.llv

[Coverage][llvm-cov] Enable MC/DC Support in LLVM Source-based Code Coverage (2/3)

Part 2 of 3. This includes the Visualization and Evaluation components.

Differential Revision: https://reviews.llvm.org/D138847

show more ...


# a50486fd 18-Sep-2023 Alan Phipps <a-phipps@ti.com>

[InstrProf][compiler-rt] Enable MC/DC Support in LLVM Source-based Code Coverage (1/3)

Part 1 of 3. This includes the LLVM back-end processing and profile
reading/writing components. compiler-rt cha

[InstrProf][compiler-rt] Enable MC/DC Support in LLVM Source-based Code Coverage (1/3)

Part 1 of 3. This includes the LLVM back-end processing and profile
reading/writing components. compiler-rt changes are included.

Differential Revision: https://reviews.llvm.org/D138846

show more ...


# 1609a87a 18-Sep-2023 Zequan Wu <zequanwu@google.com>

[Profile] Pass InstrProfSymtab by reference.


# cb9f66de 18-Sep-2023 Zequan Wu <zequanwu@google.com>

[Profile] Pass InstrProfSymtab instead of IndexedInstrProfReader when creating BinaryCoverageReader

Only InstrProfSymtab is needed to retrieve function names when debug info corrletaion is enabled.


Revision tags: llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3
# 32db121b 14-Aug-2023 Zequan Wu <zequanwu@google.com>

[Coverage] Allow Clang coverage to be used with debug info correlation.

Debug info correlation is an option in InstrProfiling pass, which is used by
both IR instrumentation and front-end instrumenta

[Coverage] Allow Clang coverage to be used with debug info correlation.

Debug info correlation is an option in InstrProfiling pass, which is used by
both IR instrumentation and front-end instrumentation. So, Clang coverage can
also benefits the binary size saving from it.

Reviewed By: ellis

Differential Revision: https://reviews.llvm.org/D157913

show more ...


# cd8fe1db 06-Sep-2023 MaggieYingYi <29144504+MaggieYingYi@users.noreply.github.com>

[llvm-cov] - Output better error message when the error kind is `coveragemap_error::malforme`. (#65264)

The current llvm-cov error message for kind `coveragemap_error::malforme`, just gives the issu

[llvm-cov] - Output better error message when the error kind is `coveragemap_error::malforme`. (#65264)

The current llvm-cov error message for kind `coveragemap_error::malforme`, just gives the issue kind without any reason for what caused the issue. This patch is aimed at improving the llvm-cov error message to help identify what caused the issue.

Reviewed By: MaskRay
Close: https://github.com/llvm/llvm-project/pull/65264

show more ...


12345