Replace SLP_TREE_SCALAR_SMTS with SLP_TREE_LANES.
Decouple SLP tree lane count from scalar statement count.
This commit continues the effort to decouple the Short Vector (SLP) vectorization’s internal representation. It replaces uses of SLP_TREE_SCALAR_SMTS with SLP_TREE_LANES where possible when determining the number of lanes in an SLP tree. This change allows the SLP vectorizer to handle cases where the number of scalar statements within a basic block does not directly correspond to the number of vector lanes, improving its ability to vectorize more complex patterns.
In Details
This patch refactors parts of the SLP (Short Vectorization) vectorizer in tree-vect-slp.cc and related files. It replaces references to SLP_TREE_SCALAR_SMTS (which implicitly tied the number of lanes to the count of scalar statements in a tree node) with SLP_TREE_LANES or checks against .exist() on the group. This change allows the SLP vectorizer to correctly handle scenarios where the number of statement nodes in an SLP tree doesn't precisely match the number of vector lanes being processed, such as when dealing with complex reductions or scalar operations interleaved with vectorizab…
- SLP vectorization
- Short Vectorization (SLP) is a compiler optimization technique that vectorizes sequences of scalar operations that operate on consecutive memory locations, even if they are not originally in a loop. It groups identical scalar operations and transforms them into a single vector operation.
- Vector lanes
- The individual processing elements within a vector register. For example, a 128-bit register might have 4 lanes if it holds 32-bit integers, or 2 lanes if it holds 64-bit floating-point numbers.
- SLP_TREE_SCALAR_SMTS
- An internal constant or macro used in the SLP vectorizer that likely represented the count of scalar statements within a particular node or structure of the SLP tree.
- SLP_TREE_LANES
- An internal constant or macro used in the SLP vectorizer that represents the number of vector lanes associated with a node or structure in the SLP tree.
- tree-vect-slp-patterns.cc
- A source file within GCC that defines patterns and rules used by the SLP vectorization pass.