Make SLP reduction group discovery fully recursive.
Enhances SLP vectorization by making reduction group discovery recursive to handle nested structures.
This commit makes the SLP (Superword-Level Parallelism) reduction group discovery process fully recursive. This allows the analysis to discover and handle sub-groups that arise from analyzing previously found isomorphic or unknown groups. The improvement is demonstrated by a test case from astcenc which now passes SLP discovery on AArch64 with SVE, revealing eight four-lane SLP reduction groups.
In Details
The vect_analyze_slp_reduction_group function in tree-vect-slp.cc has been modified to be recursive. It now handles the discovery of sub-groups within already identified reduction groups. If a sub-group analysis fails, the function recurses to analyze it further. This change simplifies vect_analyze_slp_reductions by moving part of its logic into the recursive vect_analyze_slp_reduction_group. This resolves issues with complex reduction patterns, such as those found in the astcenc test case on AArch64 with SVE.
- SLP
- Superword-Level Parallelism. A form of instruction-level parallelism where independent operations on different data elements within a vector are executed simultaneously.
- vectorization
- The process by which a compiler automatically converts scalar code (operating on single data items) into vector code (operating on multiple data items simultaneously using SIMD instructions).
- reduction group
- In the context of vectorization, a set of operations that can be combined into a single vector instruction, often involving operations like sums, products, or logical reductions.
- AArch64
- The 64-bit ARM architecture.
- SVE
- Scalable Vector Extension. An ARM instruction set extension that provides vectors whose length can vary, allowing code to adapt to different hardware capabilities.