llvm-project/llvm/test/tools/llvm-cov/Inputs
Vedant Kumar dd1ea9de2e Reland: [Coverage] Revise format to reduce binary size
Try again with an up-to-date version of D69471 (99317124 was a stale
revision).

---

Revise the coverage mapping format to reduce binary size by:

1. Naming function records and marking them `linkonce_odr`, and
2. Compressing filenames.

This shrinks the size of llc's coverage segment by 82% (334MB -> 62MB)
and speeds up end-to-end single-threaded report generation by 10%. For
reference the compressed name data in llc is 81MB (__llvm_prf_names).

Rationale for changes to the format:

- With the current format, most coverage function records are discarded.
  E.g., more than 97% of the records in llc are *duplicate* placeholders
  for functions visible-but-not-used in TUs. Placeholders *are* used to
  show under-covered functions, but duplicate placeholders waste space.

- We reached general consensus about giving (1) a try at the 2017 code
  coverage BoF [1]. The thinking was that using `linkonce_odr` to merge
  duplicates is simpler than alternatives like teaching build systems
  about a coverage-aware database/module/etc on the side.

- Revising the format is expensive due to the backwards compatibility
  requirement, so we might as well compress filenames while we're at it.
  This shrinks the encoded filenames in llc by 86% (12MB -> 1.6MB).

See CoverageMappingFormat.rst for the details on what exactly has
changed.

Fixes PR34533 [2], hopefully.

[1] http://lists.llvm.org/pipermail/llvm-dev/2017-October/118428.html
[2] https://bugs.llvm.org/show_bug.cgi?id=34533

Differential Revision: https://reviews.llvm.org/D69471
2020-02-28 18:12:04 -08:00
..
multiple_objects [llvm-cov] Avoid over-counting covered lines and regions 2017-09-15 23:00:02 +00:00
multiple_objects_not_all_instrumented Ignore object files that lack coverage information. 2019-08-28 20:35:50 +00:00
multithreaded_report [llvm-cov] Multi-threaded implementation of prepareFileReports method. 2018-01-05 16:15:07 +00:00
sources_specified [llvm-cov] Reland sources-specified.test with addition of "-path-equivalence". 2017-10-13 17:27:39 +00:00
universal_bin_wrapping_archives [Coverage] Load code coverage data from archives 2019-06-13 20:48:57 +00:00
README
binary-formats.canonical.json [llvm-cov] Delete custom JSON serialization code (NFC) 2018-09-12 21:59:38 +00:00
binary-formats.macho32b
binary-formats.macho32l
binary-formats.macho64l
binary-formats.proftext
binary-formats.v1.linux64l
binary-formats.v2.linux32l
binary-formats.v2.linux64l
binary-formats.v3.macho64l Reland: [Coverage] Revise format to reduce binary size 2020-02-28 18:12:04 -08:00
combine_expansions.covmapping
combine_expansions.proftext
copy_block_helper.gcda
copy_block_helper.gcno
deferred-regions.covmapping [llvm-cov] Fix more -path-equivalence test bugs 2017-11-09 02:50:24 +00:00
deferred-regions.profdata [llvm-cov] Remove workaround in line execution count calculation (PR34962) 2017-10-16 23:47:10 +00:00
dir-with-filtering.covmapping [llvm-cov] Create directory structure when filtering using -name*= options 2017-09-28 10:07:30 +00:00
dir-with-filtering.proftext [llvm-cov] Create directory structure when filtering using -name*= options 2017-09-28 10:07:30 +00:00
dir-with-filtering1.cpp [llvm-cov] Create directory structure when filtering using -name*= options 2017-09-28 10:07:30 +00:00
dir-with-filtering2.cpp [llvm-cov] Create directory structure when filtering using -name*= options 2017-09-28 10:07:30 +00:00
double_dots.covmapping
double_dots.proftext
elf_binary_comdat.profdata
gcov47_compatibility.gcda
gcov47_compatibility.gcno
hideUnexecutedSubviews.proftext
highlightedRanges.covmapping [Coverage] Use the wrapped segment when a line has entry segments 2017-11-09 02:33:43 +00:00
highlightedRanges.profdata
ifdef.covmapping [llvm-cov] Don't attach exec counts to lines which start a skipped region 2017-09-11 21:31:32 +00:00
ifdef.profdata [llvm-cov] Don't attach exec counts to lines which start a skipped region 2017-09-11 21:31:32 +00:00
instrprof-comdat.h [Coverage] Use the wrapped segment when a line has entry segments 2017-11-09 02:33:43 +00:00
lineExecutionCounts.covmapping [Coverage] Use the wrapped segment when a line has entry segments 2017-11-09 02:33:43 +00:00
lineExecutionCounts.proftext
malformedRegions.covmapping [Coverage] Report errors when reading malformed source regions 2017-09-08 18:44:47 +00:00
multiple-files.covmapping
multiple-files.proftext
multiple-files2.covmapping
name_whitelist.covmapping [llvm-cov] Read in function names for filtering from a text file. 2017-08-31 09:11:31 +00:00
name_whitelist.cpp [llvm-cov] Read in function names for filtering from a text file. 2017-08-31 09:11:31 +00:00
name_whitelist.proftext [llvm-cov] Read in function names for filtering from a text file. 2017-08-31 09:11:31 +00:00
native_separators.covmapping
path_equivalence.covmapping
path_equivalence.proftext
prefer_used_to_unused.covmapping [llvm-cov] Fix more -path-equivalence test bugs 2017-11-09 02:50:24 +00:00
prefer_used_to_unused.cpp
prefer_used_to_unused.proftext
prevent_false_instantiations.covmapping
prevent_false_instantiations.cpp
prevent_false_instantiations.proftext
range_based_for.gcda
range_based_for.gcno
regionMarkers.covmapping [Coverage] Use the wrapped segment when a line has entry segments 2017-11-09 02:33:43 +00:00
regionMarkers.proftext
report.covmapping [Coverage] Use the wrapped segment when a line has entry segments 2017-11-09 02:33:43 +00:00
report.profdata
showExpansions.covmapping
showExpansions.json [llvm-cov] Delete custom JSON serialization code (NFC) 2018-09-12 21:59:38 +00:00
showExpansions.profdata
showProjectSummary.covmapping
showProjectSummary.proftext
showProjectSummary.test
showTabsHTML.covmapping
showTabsHTML.proftext
templateInstantiations.covmapping [Coverage] Use the wrapped segment when a line has entry segments 2017-11-09 02:33:43 +00:00
templateInstantiations.profdata
test.cpp
test.gcda
test.gcno
test.h
test_-a.cpp.gcov [gcov] Fix wrong line hit counts when multiple blocks are on the same line 2018-09-20 16:09:30 +00:00
test_-a.h.gcov [gcov] Fix wrong line hit counts when multiple blocks are on the same line 2018-09-20 16:09:30 +00:00
test_-a_-b.cpp.gcov [gcov] Fix wrong line hit counts when multiple blocks are on the same line 2018-09-20 16:09:30 +00:00
test_-a_-b.h.gcov [gcov] Fix wrong line hit counts when multiple blocks are on the same line 2018-09-20 16:09:30 +00:00
test_-a_-b_-c_-u.cpp.gcov [gcov] Fix wrong line hit counts when multiple blocks are on the same line 2018-09-20 16:09:30 +00:00
test_-a_-b_-c_-u.h.gcov [gcov] Fix wrong line hit counts when multiple blocks are on the same line 2018-09-20 16:09:30 +00:00
test_-a_-b_-u.cpp.gcov [gcov] Fix wrong line hit counts when multiple blocks are on the same line 2018-09-20 16:09:30 +00:00
test_-a_-b_-u.h.gcov [gcov] Fix wrong line hit counts when multiple blocks are on the same line 2018-09-20 16:09:30 +00:00
test_-b.output
test_-b_-f.output
test_-f.output
test_exit_block_arcs.gcda
test_exit_block_arcs.gcno
test_file_checksum_fail.gcda
test_func_checksum_fail.gcda
test_hash.output [llvm-cov] Add support for gcov --hash-filenames option 2019-02-19 20:45:00 +00:00
test_long_file_names.output
test_long_paths.output
test_missing.cpp.gcov [gcov] Fix wrong line hit counts when multiple blocks are on the same line 2018-09-20 16:09:30 +00:00
test_missing.h.gcov
test_missing.output
test_no_gcda.cpp.gcov
test_no_gcda.h.gcov
test_no_gcda.output
test_no_options.cpp.gcov [gcov] Fix wrong line hit counts when multiple blocks are on the same line 2018-09-20 16:09:30 +00:00
test_no_options.h.gcov
test_no_options.output
test_no_output.output
test_no_preserve_paths.output
test_objdir.cpp.gcov [gcov] Fix wrong line hit counts when multiple blocks are on the same line 2018-09-20 16:09:30 +00:00
test_objdir.h.gcov
test_paths.cpp.gcov [gcov] Fix wrong line hit counts when multiple blocks are on the same line 2018-09-20 16:09:30 +00:00
test_paths.gcda
test_paths.gcno
test_paths.h.gcov
test_preserve_paths.output
test_read_fail.gcno
universal-binary
universal-binary.proftext
whitelist1.txt [llvm-cov] Read in function names for filtering from a text file. 2017-08-31 09:11:31 +00:00
whitelist2.txt [llvm-cov] Read in function names for filtering from a text file. 2017-08-31 09:11:31 +00:00
zeroFunctionFile.covmapping
zeroFunctionFile.h
zeroFunctionFile.proftext

README

These inputs were pre-generated to allow for easier testing of llvm-cov.

The files used to test the gcov compatible code coverage tool were generated
using the following method:

  test.gcno and test.gcda were create by running clang:
    clang++ -g -ftest-coverage -fprofile-arcs test.cpp

  test.cpp.gcov was created by running gcov 4.2.1:
    gcov test.cpp

The 'covmapping' files that are used to test llvm-cov contain raw sections
with the coverage mapping data generated by the compiler and linker. They are
created by running clang and llvm-cov:
  clang++ -fprofile-instr-generate -fcoverage-mapping -o test test.cpp
  llvm-cov convert-for-testing -o test.covmapping test

The 'profdata' files were generated by running an instrumented version of the
program and merging the raw profile data using llvm-profdata.
  ./test
  llvm-profdata merge -o test.profdata default.profraw