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

Unshare header computation for more CSE in vectorized loops

Vectorization now shares address computations between scalar and vector code for better common subexpression elimination.

This patch improves vectorization by delaying the folding of offsets into base addresses. By keeping base addresses separate, the compiler can perform more common subexpression elimination (CSE) in the pre-header of vectorized loops, reducing instruction count and improving performance.

In Details

The vect pass now avoids folding offsets into base addresses too early in vect_create_addr_base_for_vector_ref. Instead, it forms an explicit base + offset expression. This allows the Value Numbering (VN) pass at the end of vectorization to share address computations between scalar code (e.g., for alignment checks) and the vectorized code, reducing instruction overhead in loop pre-headers.

For Context
CSE
Common Subexpression Elimination. A compiler optimization that finds and eliminates redundant computations of the same expression.
Vectorization
A compiler optimization that transforms a loop to operate on multiple data elements simultaneously, often using SIMD (Single Instruction, Multiple Data) instructions.
Filed Under: vectoptimizationcse