GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
gcov Performance Win

gcov: Build edge updates in a local sequence

Gcov condition coverage generation now batches updates to edges for improved performance.

This change optimizes gcov’s condition coverage instrumentation by accumulating edge updates in a local gimple_seq before emitting them. Previously, individual statements were inserted directly onto edges, leading to repeated operations for the same edge. By building a sequence and inserting it once, this change reduces redundant work and improves the efficiency of code generation for coverage analysis.

In Details

Optimizes tree-profile.cc in gcov by refactoring its GIMPLE emission helpers (emit_assign, emit_bitwise_op) to accept and append to a caller-provided gimple_seq. The instrument_decisions function is updated to construct a local gimple_seq for each edge, consolidating multiple statement emissions into a single call to gsi_insert_seq_on_edge. This avoids redundant GSI insertions and simplifies edge management.

For Context
gcov
A code coverage tool provided with GCC. It analyzes program execution count and lines executed to identify parts of a program that are or are not being tested.
gimple_seq
A sequence of GIMPLE statements. GIMPLE is an intermediate representation used by GCC. A gimple_seq acts as a list or block of these statements.
GSI
GIMPLE Statement Insertion. Refers to the API functions within GCC for inserting GIMPLE statements into the intermediate representation.
condition coverage
A type of code coverage that tracks how often each boolean sub-expression within a conditional statement (like if or while) evaluates to true or false.
Filed Under: gcovoptimizationcode coverage