History log of /llvm-project/clang/test/CodeGen/code-coverage.c (Results 1 – 25 of 34)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7
# 82fecab8 03-Jan-2025 Fangrui Song <i@maskray.me>

[gcov] Bump default version to 11.1

The gcov version is set to 11.1 (compatible with gcov 9) even if
`-Xclang -coverage-version=` specified version is less than 11.1.

Therefore, we can drop produce

[gcov] Bump default version to 11.1

The gcov version is set to 11.1 (compatible with gcov 9) even if
`-Xclang -coverage-version=` specified version is less than 11.1.

Therefore, we can drop producer support for version < 11.1.

show more ...


Revision tags: llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3
# f9d07890 17-Oct-2024 Qiongsi Wu <274595+qiongsiwu@users.noreply.github.com>

[PGO] Initialize GCOV Writeout and Reset Functions in the Runtime on AIX (#108570)

This PR registers the writeout and reset functions for `gcov` for all
modules in the PGO runtime, instead of regis

[PGO] Initialize GCOV Writeout and Reset Functions in the Runtime on AIX (#108570)

This PR registers the writeout and reset functions for `gcov` for all
modules in the PGO runtime, instead of registering them
using global constructors in each module. The change is made for AIX
only, but the same mechanism works on Linux on Power.

When registering such functions using global constructors in each module
without `-ffunction-sections`, the AIX linker cannot garbage collect
unused undefined symbols, because such symbols are grouped in the same
section as the `__sinit` symbol. Keeping such undefined symbols causes
link errors (see test case
https://github.com/llvm/llvm-project/pull/108570/files#diff-500a7e1ba871e1b6b61b523700d5e30987900002add306e1b5e4972cf6d5a4f1R1
for this scenario). This PR implements the initialization in the
runtime, hence avoiding introducing `__sinit` into each module.

The implementation adds a new global variable `__llvm_covinit_functions`
to each module. This new global variable contains the function pointers
to the `Writeout` and `Reset` functions. `__llvm_covinit_functions`'s
section is the named section `__llvm_covinit`. The linker will aggregate
all the `__llvm_covinit` sections from each module
to form one single named section in the final binary. The pair of
functions
```
const __llvm_gcov_init_func_struct *__llvm_profile_begin_covinit();
const __llvm_gcov_init_func_struct *__llvm_profile_end_covinit();
```
are implemented to return the start and end address of this named
section in the final binary, and they are used in function
```
__llvm_profile_gcov_initialize()
```
(which is a constructor function in the runtime) so the runtime knows
the addresses of all the `Writeout` and `Reset` functions from all the
modules.

One noticeable implementation detail relevant to AIX is that to preserve
the `__llvm_covinit` from the linker's garbage collection, a `.ref`
pseudo instruction is inserted into them, referring to the section that
contains the `__llvm_gcov_ctr` variables, which are used in the
instrumented code. The `__llvm_gcov_ctr` variables did not belong to
named sections before, but this PR added them to the
`__llvm_gcov_ctr_section` named section, so we can add a `.ref` pseudo
instruction that refers to them in the `__llvm_covinit` section.

show more ...


Revision tags: llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, 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, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3
# 1ab68d70 03-Oct-2023 Matheus Izvekov <mizvekov@gmail.com>

[clang][codegen] Add a verifier IR pass before any further passes. (#68015)

This helps check clang generated good IR in the first place, as
otherwise this can cause UB in subsequent passes, with th

[clang][codegen] Add a verifier IR pass before any further passes. (#68015)

This helps check clang generated good IR in the first place, as
otherwise this can cause UB in subsequent passes, with the final
verification pass not catching any issues.

This for example would have helped catch
https://github.com/llvm/llvm-project/issues/67937 earlier.

show more ...


Revision tags: llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3
# 64473f12 15-Aug-2023 Fangrui Song <i@maskray.me>

[gcov] Use Joined = form for -coverage-notes-file and -coverage-data-file


Revision tags: llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5
# ac8ccbbd 18-May-2023 Fangrui Song <i@maskray.me>

[test] Driver/code-coverage.c: chdir to a temporary directory

-coverage-notes-file=aaa.gcno -coverage-data-file=bbb.gcda creates aaa.gcno in
the current directory (a pattern to be avoided; which may

[test] Driver/code-coverage.c: chdir to a temporary directory

-coverage-notes-file=aaa.gcno -coverage-data-file=bbb.gcda creates aaa.gcno in
the current directory (a pattern to be avoided; which may be read-only in an
alternative lit runner).

show more ...


# 71a35f7e 17-May-2023 Fangrui Song <i@maskray.me>

[gcov] Simplify cc1 options and remove CodeGenOptions EmitCovNotes/EmitCovArcs

After a07b135ce0c0111bd83450b5dc29ef0381cdbc39, we always pass
-coverage-notes-file/-coverage-data-file for driver opti

[gcov] Simplify cc1 options and remove CodeGenOptions EmitCovNotes/EmitCovArcs

After a07b135ce0c0111bd83450b5dc29ef0381cdbc39, we always pass
-coverage-notes-file/-coverage-data-file for driver options
-ftest-coverage/-fprofile-arcs/--coverage. As a bonus, we can make the following
simplification to cc1 options:

* `-ftest-coverage -coverage-notes-file a.gcno` => `-coverage-notes-file a.gcno`
* `-fprofile-arcs -coverage-data-file a.gcda` => `-coverage-data-file a.gcda`

and remove EmitCovNotes/EmitCovArcs.

show more ...


Revision tags: llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3
# 86bfeb90 10-Feb-2023 David Green <david.green@arm.com>

Revert "Inlining: Run the legacy AlwaysInliner before the regular inliner."

This seems to cause large regressions in existing code, as much as 75% slower
(4x the time taken). Small always inline fun

Revert "Inlining: Run the legacy AlwaysInliner before the regular inliner."

This seems to cause large regressions in existing code, as much as 75% slower
(4x the time taken). Small always inline functions seem to be used a lot in the
cmsis-dsp library.

I would add a phase ordering test to show the problems, but one already exists!
The llvm/test/Transforms/PhaseOrdering/ARM/arm_mult_q15.ll was just changed by
removing alwaysinline to hide the problems that existed.

This reverts commit cae033dcf227aeecf58fca5af6fc7fde1fd2fb4f.
This reverts commit 8e33c41e72ad42e4c27f8cbc3ad2e02b169637a1.

show more ...


# cae033dc 09-Feb-2023 Amara Emerson <amara@apple.com>

Inlining: Run the legacy AlwaysInliner before the regular inliner.

We have several situations where it's beneficial for code size to ensure that every
call to always-inline functions are inlined bef

Inlining: Run the legacy AlwaysInliner before the regular inliner.

We have several situations where it's beneficial for code size to ensure that every
call to always-inline functions are inlined before normal inlining decisions are
made. While the normal inliner runs in a "MandatoryOnly" mode to try to do this,
it only does it on a per-SCC basis, rather than the whole module. Ensuring that
all mandatory inlinings are done before any heuristic based decisions are made
just makes sense.

Despite being referred to the "legacy" AlwaysInliner pass, it's already necessary
for -O0 because the CGSCC inliner is too expensive in compile time to run at -O0.

This also fixes an exponential compile time blow up in
https://github.com/llvm/llvm-project/issues/59126

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

show more ...


Revision tags: llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init, llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1
# 61d418f9 11-Apr-2022 Arthur Eubanks <aeubanks@google.com>

[test] Remove references to -fexperimental-new-pass-manager in tests

This has been the default for a while and we're in the process of removing the legacy PM optimization pipeline.


Revision tags: llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1, llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1, llvmorg-13.0.0, llvmorg-13.0.0-rc4, llvmorg-13.0.0-rc3, llvmorg-13.0.0-rc2, llvmorg-13.0.0-rc1, llvmorg-14-init, llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2, llvmorg-12.0.1-rc1, llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4, llvmorg-12.0.0-rc3, llvmorg-12.0.0-rc2, llvmorg-11.1.0, llvmorg-11.1.0-rc3, llvmorg-12.0.0-rc1, llvmorg-13-init, llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1, llvmorg-11.0.1, llvmorg-11.0.1-rc2, llvmorg-11.0.1-rc1
# 8dbe44cb 16-Nov-2020 Florian Hahn <flo@fhahn.com>

Add pass to add !annotate metadata from @llvm.global.annotations.

This patch adds a new pass to add !annotation metadata for entries in
@llvm.global.anotations, which is generated using
__attribute

Add pass to add !annotate metadata from @llvm.global.annotations.

This patch adds a new pass to add !annotation metadata for entries in
@llvm.global.anotations, which is generated using
__attribute__((annotate("_name"))) on functions in Clang.

This has been discussed on llvm-dev as part of
RFC: Combining Annotation Metadata and Remarks
http://lists.llvm.org/pipermail/llvm-dev/2020-November/146393.html

Reviewed By: thegameg

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

show more ...


# 545c687c 20-Oct-2020 Fangrui Song <i@maskray.me>

[gcov] Unify driver and CC1 option names for -ftest-coverage & -fprofile-arcs

No need to use -femit-coverage-notes and -femit-coverage-data.


Revision tags: llvmorg-11.0.0, llvmorg-11.0.0-rc6, llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4, llvmorg-11.0.0-rc3
# f086e85e 13-Sep-2020 Fangrui Song <i@maskray.me>

[gcov] Assign names to some types and loaded values used in @__llvm_internal*

This makes the generated IR much more readable.


# d6fadc49 12-Sep-2020 Fangrui Song <i@maskray.me>

[gcov] Process .gcda immediately after the accompanying .gcno instead of doing all .gcda after all .gcno

i.e. change the work flow from

* .gcno for function A
* .gcno for function B
* .gcno for fun

[gcov] Process .gcda immediately after the accompanying .gcno instead of doing all .gcda after all .gcno

i.e. change the work flow from

* .gcno for function A
* .gcno for function B
* .gcno for function C
* .gcda for function A
* .gcda for function B
* .gcda for function C

to

* .gcno for function A
* .gcda for function A
* .gcno for function B
* .gcda for function B
* .gcno for function C
* .gcda for function C

Currently there is duplicate logic in .gcno & .gcda processing: how functions
are filtered, which edges are instrumented, etc. This refactor enables simplification.

Since we always process .gcno, in -fprofile-arcs -fno-test-coverage mode,
__llvm_internal_gcov_emit_function_args.0 will have non-zero checksums.

show more ...


Revision tags: llvmorg-11.0.0-rc2, llvmorg-11.0.0-rc1
# 5809a32e 18-Jul-2020 Fangrui Song <i@maskray.me>

[gcov] Add __gcov_dump/__gcov_reset and delete __gcov_flush

GCC r187297 (2012-05) introduced `__gcov_dump` and `__gcov_reset`.
`__gcov_flush = __gcov_dump + __gcov_reset`

The resolution to https:

[gcov] Add __gcov_dump/__gcov_reset and delete __gcov_flush

GCC r187297 (2012-05) introduced `__gcov_dump` and `__gcov_reset`.
`__gcov_flush = __gcov_dump + __gcov_reset`

The resolution to https://gcc.gnu.org/PR93623 ("No need to dump gcdas when forking" target GCC 11.0) removed the unuseful and undocumented __gcov_flush.

Close PR38064.

Reviewed By: calixte, serge-sans-paille

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

show more ...


Revision tags: llvmorg-12-init, llvmorg-10.0.1, llvmorg-10.0.1-rc4, llvmorg-10.0.1-rc3
# b0b5162f 05-Jul-2020 Fangrui Song <maskray@google.com>

[Driver] Pass -gno-column-info instead of -dwarf-column-info

Making -g[no-]column-info opt out reduces the length of a typical CC1 command line.
Additionally, in a non-debug compile, we won't see -d

[Driver] Pass -gno-column-info instead of -dwarf-column-info

Making -g[no-]column-info opt out reduces the length of a typical CC1 command line.
Additionally, in a non-debug compile, we won't see -dwarf-column-info.

show more ...


Revision tags: llvmorg-10.0.1-rc2
# e664d054 07-Jun-2020 Fangrui Song <maskray@google.com>

[gcov] Improve tests and lower the minimum supported version to gcov 3.4

global-ctor.ll no longer checks what it intended to check
(@_GLOBAL__sub_I_global-ctor.ll needs a !dbg to work).
Rewrite it.

[gcov] Improve tests and lower the minimum supported version to gcov 3.4

global-ctor.ll no longer checks what it intended to check
(@_GLOBAL__sub_I_global-ctor.ll needs a !dbg to work).
Rewrite it.

gcov 3.4 and gcov 4.2 use the same format, thus we can lower the version
requirement to 3.4

show more ...


# cdd683b5 06-Jun-2020 Fangrui Song <maskray@google.com>

[gcov] Support big-endian .gcno and simplify version handling in .gcda


Revision tags: llvmorg-10.0.1-rc1
# 25a95f49 12-May-2020 Fangrui Song <maskray@google.com>

[gcov][test] Fix clang test


# 25544ce2 10-May-2020 Fangrui Song <maskray@google.com>

[gcov] Default coverage version to '407*' and delete CC1 option -coverage-cfg-checksum

Defaulting to -Xclang -coverage-version='407*' makes .gcno/.gcda
compatible with gcov [4.7,8)

In addition, del

[gcov] Default coverage version to '407*' and delete CC1 option -coverage-cfg-checksum

Defaulting to -Xclang -coverage-version='407*' makes .gcno/.gcda
compatible with gcov [4.7,8)

In addition, delete clang::CodeGenOptionsBase::CoverageExtraChecksum and GCOVOptions::UseCfgChecksum.
We can infer the information from the version.

With this change, .gcda files produced by `clang --coverage a.o` linked executable can be read by gcov 4.7~7.
We don't need other -Xclang -coverage* options.
There may be a mismatching version warning, though.

(Note, GCC r173147 "split checksum into cfg checksum and line checksum"
made gcov 4.7 incompatible with previous versions.)

show more ...


# 13a633b4 10-May-2020 Fangrui Song <maskray@google.com>

[gcov] Delete CC1 option -coverage-no-function-names-in-data

rL144865 incorrectly wrote function names for GCOV_TAG_FUNCTION
(this might be part of the reasons the header says
"We emit files in a co

[gcov] Delete CC1 option -coverage-no-function-names-in-data

rL144865 incorrectly wrote function names for GCOV_TAG_FUNCTION
(this might be part of the reasons the header says
"We emit files in a corrupt version of GCOV's "gcda" file format").

rL176173 and rL177475 realized the problem and introduced -coverage-no-function-names-in-data
to work around the issue. (However, the description is wrong.
libgcov never writes function names, even before GCC 4.2).

In reality, the linker command line has to look like:

clang --coverage -Xclang -coverage-version='407*' -Xclang -coverage-cfg-checksum -Xclang -coverage-no-function-names-in-data

Failing to pass -coverage-no-function-names-in-data can make gcov 4.7~7
either produce wrong results (for one gcov-4.9 program, I see "No executable lines")
or segfault (gcov-7).
(gcov-8 uses an incompatible format.)

This patch deletes -coverage-no-function-names-in-data and the related
function names support from libclang_rt.profile

show more ...


Revision tags: llvmorg-10.0.0, llvmorg-10.0.0-rc6, llvmorg-10.0.0-rc5, llvmorg-10.0.0-rc4, llvmorg-10.0.0-rc3, llvmorg-10.0.0-rc2, llvmorg-10.0.0-rc1, llvmorg-11-init, llvmorg-9.0.1, llvmorg-9.0.1-rc3, llvmorg-9.0.1-rc2, llvmorg-9.0.1-rc1, llvmorg-9.0.0, llvmorg-9.0.0-rc6, llvmorg-9.0.0-rc5, llvmorg-9.0.0-rc4, llvmorg-9.0.0-rc3, llvmorg-9.0.0-rc2, llvmorg-9.0.0-rc1, llvmorg-10-init, llvmorg-8.0.1, llvmorg-8.0.1-rc4, llvmorg-8.0.1-rc3, llvmorg-8.0.1-rc2, llvmorg-8.0.1-rc1, llvmorg-8.0.0, llvmorg-8.0.0-rc5, llvmorg-8.0.0-rc4, llvmorg-8.0.0-rc3, llvmorg-7.1.0, llvmorg-7.1.0-rc1, llvmorg-8.0.0-rc2, llvmorg-8.0.0-rc1, llvmorg-7.0.1, llvmorg-7.0.1-rc3, llvmorg-7.0.1-rc2, llvmorg-7.0.1-rc1, llvmorg-7.0.0
# 3dcdf9e4 11-Sep-2018 Vedant Kumar <vsk@apple.com>

[gcov] Update a clang test for r341977

Update test/CodeGen/code-coverage.c so that it doesn't refer to a gcov
function which is no longer emitted after r341977.

Fixes bot failure:
http://lab.llvm.o

[gcov] Update a clang test for r341977

Update test/CodeGen/code-coverage.c so that it doesn't refer to a gcov
function which is no longer emitted after r341977.

Fixes bot failure:
http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/23831

llvm-svn: 341985

show more ...


Revision tags: llvmorg-7.0.0-rc3, llvmorg-7.0.0-rc2, llvmorg-7.0.0-rc1, llvmorg-6.0.1, llvmorg-6.0.1-rc3, llvmorg-6.0.1-rc2
# 9325c38f 02-May-2018 Chandler Carruth <chandlerc@gmail.com>

[gcov] Make the CLang side coverage test work with the new
instrumentation codegeneration strategy of using a data structure and
a loop. Required some finesse to get the critical things being tested

[gcov] Make the CLang side coverage test work with the new
instrumentation codegeneration strategy of using a data structure and
a loop. Required some finesse to get the critical things being tested to
surface in a nice way for FileCheck but I think this preserves the
original intent of the test.

llvm-svn: 331411

show more ...


Revision tags: llvmorg-6.0.1-rc1, llvmorg-5.0.2, llvmorg-5.0.2-rc2, llvmorg-5.0.2-rc1, llvmorg-6.0.0, llvmorg-6.0.0-rc3, llvmorg-6.0.0-rc2
# ac904d0e 23-Jan-2018 David Blaikie <dblaikie@gmail.com>

NewPM: Improve/fix GCOV - which needs to run early in the pass pipeline.

Using a new extension point in the new PM, register GCOV at the start of
the pipeline rather than the end.

llvm-svn: 323167


Revision tags: llvmorg-6.0.0-rc1
# 7a4f7f56 09-Jan-2018 David Blaikie <dblaikie@gmail.com>

Wire up GCOV to the new pass manager

GCOV in the old pass manager also strips debug info (if debug info is
disabled/only produced for profiling anyway) after the GCOV pass runs.

I think the strip p

Wire up GCOV to the new pass manager

GCOV in the old pass manager also strips debug info (if debug info is
disabled/only produced for profiling anyway) after the GCOV pass runs.

I think the strip pass hasn't been ported to the new pass manager, so it
might take me a little while to wire that up.

llvm-svn: 322126

show more ...


Revision tags: llvmorg-5.0.1, llvmorg-5.0.1-rc3, llvmorg-5.0.1-rc2, llvmorg-5.0.1-rc1, llvmorg-5.0.0, llvmorg-5.0.0-rc5, llvmorg-5.0.0-rc4, llvmorg-5.0.0-rc3, llvmorg-5.0.0-rc2, llvmorg-5.0.0-rc1, llvmorg-4.0.1, llvmorg-4.0.1-rc3, llvmorg-4.0.1-rc2, llvmorg-4.0.1-rc1, llvmorg-4.0.0, llvmorg-4.0.0-rc4, llvmorg-4.0.0-rc3, llvmorg-4.0.0-rc2, llvmorg-4.0.0-rc1, llvmorg-3.9.1, llvmorg-3.9.1-rc3, llvmorg-3.9.1-rc2, llvmorg-3.9.1-rc1
# 877428de 17-Oct-2016 Davide Italiano <davide@freebsd.org>

[Coverage] Update test after r284418.

We now strip coverage metadata if debug info are not present.

llvm-svn: 284419


12