FRIDAY, SEPTEMBER 18, 2026
tree-optimization Performance Win
Avoid starting SLP groups with unvectorizable loads
Prevents SLP optimization from beginning a vectorization group with a load instruction that cannot be vectorized.
This commit addresses a bug in SLP discovery by preventing it from starting a vectorization group with an unvectorizable load instruction. The change refactors how non-grouped loads are handled, ensuring that such loads are rejected early in the process before being incorrectly selected as the first match for a group.
In Details
Fixes PR tree-optimization/127146 by refactoring vect_build_slp_tree_3 in tree-vect-slp.cc. It duplicates the logic for rejecting non-grouped loads to happen before assigning first_match, thus avoiding the initiation of an SLP group with an unvectorizable load.
For Context
- SLP (Simultaneous Loop Parallelization)
- A compiler optimization technique that identifies opportunities to perform loop-independent operations in parallel, even within a single iteration.
- SLP discovery
- The phase within the SLP optimization where the compiler identifies potential parallelizable instruction patterns.
- unvectorizable load
- A memory load instruction that the compiler's vectorization pass cannot effectively transform into a wider, parallel load operation.
- tree-vect-slp.cc
- The GCC source file containing implementations for SLP vectorization.
- PR tree-optimization/127473
- A bug report filed against the GCC tree-optimization component, specifically related to SLP vectorization issues.