tree-optimization: Disable SLP vectorization with gaps for negative steps
Disables SLP vectorization for negative step sizes when gaps are present, as the current implementation cannot handle them.
This commit disables Store-Load-Pair (SLP) vectorization for loops with negative step sizes and memory gaps. The existing vectorization path for strided SLP does not support handling smaller vectors to avoid gaps or using peeling to manage gaps encountered with the first vector load, thus preventing incorrect code generation.
In Details
Disables VMAT_STRIDED_SLP vectorization when the loop step is negative and memory gaps are present (PR tree-optimization/127601). The current implementation of VMAT_STRIDED_SLP does not support the necessary logic to either use smaller vector loads to avoid touching a gap or to employ peeling to manage gaps that would be encountered by the first vector load. The changes in get_load_store_type adjust overrun flag handling and assert memory access types more correctly, explicitly disallowing VMAT_STRIDED_SLP for negative steps.
- SLP vectorization
- Store-Load-Pair vectorization. A compiler optimization technique that groups consecutive memory stores and loads to create vector operations, even when the operations are not in a typical loop structure.
- Store-Load-Pair (SLP)
- A compiler optimization technique that identifies and vectorizes sequences of memory store and load operations.
- vectorization
- The process by which a compiler transforms code to use SIMD (Single Instruction, Multiple Data) instructions, enabling operations on multiple data elements simultaneously.
- memory gap
- A region of memory that is not accessed by a loop or a sequence of operations, potentially disrupting contiguous vector loads or stores.
- peeling
- A loop transformation technique where one or more initial iterations of a loop are separated and executed before the main loop body, often to align data or handle specific conditions.
- VMAT_STRIDED_SLP
- A specific vectorization mode within GCC, likely referring to strided SLP vectorization, used for memory access patterns with a constant stride.