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

Replace length-bounded iterations with for-each in SLP analysis

SLP analysis now uses for-each loops to improve clarity and phase-out notion of scalar statement counts determining lanes.

The SLP (Simultaneous Local Processing) vectorization analysis has been updated to replace iteration patterns that rely on the number of scalar statements or operations with more idiomatic for-each loops. This change aims to simplify the internal representation and remove the confusing notion that the count of scalar elements dictates the number of vector lanes, promoting a more abstract approach to SLP tree analysis.

In Details

This commit refactors data-dependency analysis and SLP tree construction in tree-vect-data-refs.cc and tree-vect-slp.cc. It replaces explicit indexing using .length() on SLP_TREE_SCALAR_STMTS and SLP_TREE_SCALAR_OPS with range-based for loops (for-each). This aligns with the ongoing effort to decouple the number of lanes in SLP from the count of scalar statements/operations, making the internal representation cleaner.

For Context
SLP
Simultaneous Local Processing. A compiler technique that vectorizes straight-line code (basic blocks) by finding opportunities to execute multiple scalar operations in parallel.
Scalar Statement/Operation
A single, non-vectorized instruction or statement that operates on a single data element.
Filed Under: vectslprefactor