vect: Do not set niters range for partial vect.
Vectorization pass correctly avoids setting iteration range for partial vectorization.
The vectorization pass in GCC has been updated to correctly handle partial vectorization scenarios. Previously, the vect_do_peeling function would set the iteration count range to [0, VF] even for partial vectorization, which is too conservative. This could lead to incorrect loop unrolling or peeling. The fix ensures that this range is only set when not performing partial vectorization, allowing for more accurate optimization.
In Details
The vect_do_peeling function in tree-vect-loop-manip.cc previously set the NITER range [0, VF] unconditionally when peeling for alignment. This is incorrect for partial vectorization, where the loop might only perform a single scalar iteration. The commit adds a guard !partial_vectors_p to this range setting, ensuring it's only applied when full vectorization is considered.
- vectorization
- An optimization technique where the compiler transforms a loop to operate on multiple data elements simultaneously using specialized vector instructions.
- vect
- Refers to the vectorization subsystem within the GCC compiler.
- peeling
- A loop transformation technique used in vectorization where a few initial or final iterations of a loop are extracted and executed separately to align the loop body with vector register sizes or other constraints.
- partial vectorization
- A form of vectorization where the loop body operates on fewer elements than a full vector register can hold, often due to loop-independent dependencies or specific alignment requirements.
- NITER
- Represents the number of iterations for a loop during the GCC optimization passes.
- VF
- Vector Factor. In vectorization, VF typically denotes the number of elements that can be processed in parallel by a single vector instruction.