GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
cprop Performance Win

cprop: Cache find_bypass_set results per block.

Constant propagation pass caches jump bypass results, improving performance on code with repetitive checks.

The constant propagation pass (cprop) now caches the results of find_bypass_set on a per-block basis. This optimization significantly speeds up compilation for code with chains of identical conditional checks, such as if (v == K). By caching the results of searching for register sets available at the end of a block, the pass avoids redundant computations, reducing compile times by up to 30% for the affected test cases.

In Details

The cprop pass has introduced caching for find_bypass_set results on a per-basic-block basis. The find_bypass_set function previously iterated through a chain of register sets in a hash table until it found one available at the end of a block. In scenarios with many repeated checks (e.g., the PR's test case with N tests of if (v == K)), this led to repeated, costly traversals of long chains. The new bypass_set_cache stores the result of the last query for each basic block, avoiding redundant work when the same register set is queried again within the same block. This optimization…

For Context
cprop
Constant Propagation. A compiler optimization that replaces variables or expressions with their known constant values.
Basic Block
A sequence of instructions with a single entry point and a single exit point. Control flow enters at the beginning and proceeds without halt or possibility of diversion until the end.
Cache
A mechanism for storing frequently accessed data in a faster-access memory location to speed up subsequent requests for that data.
Hash Table
A data structure that implements an associative array abstract data type, a structure that can map keys to values. It uses a hash function to compute an index into an array of buckets or slots.
Filed Under: optimizationcpropcache