GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc Performance Win

Cost each BB vect live lane only once

GCC's vectorizer now costs each basic block's live lane only once, optimizing code generation for SLP trees.

This commit optimizes the costing of live scalar statements within basic blocks during SLP (Superword Level Parallelism) vectorization. By ensuring that each live lane is costed only once, even if it appears in multiple SLP nodes, the compiler can make more accurate decisions about which SLP node to use for code generation. This leads to more efficient vectorization and potentially improved performance.

In Details

The patch introduces a new vector, SLP_TREE_LIVE_LANES, in _slp_tree to track live lanes. The code now costs each basic block's vect live lane only once. The vect_bb_slp_mark_live_stmts function no longer verifies that code can be generated from all SLP nodes but picks the first one available. The changes affect tree-vect-loop.cc, tree-vect-slp.cc, and tree-vect-stmts.cc.

For Context

Vectorization is a compiler optimization technique that converts scalar operations into vector operations, processing multiple data elements simultaneously. SLP (Superword Level Parallelism) is a specific form of vectorization that exploits parallelism within basic blocks. This commit optimizes the cost modeling during SLP vectorization, ensuring that the compiler accurately assesses the cost of generating vectorized code, leading to better performance.

Filed Under: optimizationvectorizationslpcode generation