Fix outer loop vectorization data reference analysis.
GCC's vectorizer now correctly analyzes data references for outer loop vectorization by using MEM_REF instead of INDIRECT_REF.
GCC’s vectorizer has been fixed to correctly analyze data references for outer loop vectorization. The previous implementation used build_fold_indirect_ref, which led to incorrect type and alignment analysis. This change replaces it with a MEM_REF of the original DR_REF type, enabling more accurate analysis of the innermost loop’s behavior. A new test case, pr127049.C, is included to verify the fix.
In Details
The vect_analyze_data_refs function in tree-vect-data-refs.cc previously constructed an INDIRECT_REF to represent a data reference within the innermost loop for outer loop vectorization analysis. This led to issues with type and alignment analysis. This commit changes the construction to use MEM_REF while preserving the original DR_REF type, which is more appropriate for representing memory accesses and allows for better analysis of loop-carried dependencies relevant to vectorization.
- vectorization
- An optimization technique that allows the compiler to use special SIMD (Single Instruction, Multiple Data) instructions to perform the same operation on multiple data elements simultaneously.
- outer loop vectorization
- A vectorization strategy where the compiler attempts to vectorize an outer loop, potentially enabling more data parallelism than inner loop vectorization.
- MEM_REF
- An RTX (representation RTX) code in GCC representing a memory reference, typically used for accesses to memory locations.
- INDIRECT_REF
- An RTX code in GCC representing an indirect memory reference, often used when an address is computed dynamically.
- DR_REF
- Likely refers to a data reference information structure used within GCC's data-reference analysis for loops.