improve vect_optimize_slp_pass::containing_loop
Enhances GCC's SLP vectorizer to better identify the containing loop for VEC_PERM nodes.
GCC’s SLP (Short-Loop-as-Parallel) vectorization pass has been improved to more accurately determine the containing loop for VEC_PERM nodes. Previously, it might fall back to the loop root node. This change now uses the region entry block to indicate the containing loop when a node lacks a representative, avoiding unnecessary fallbacks.
In Details
The containing_loop method within vect_optimize_slp_pass in tree-vect-slp.cc is refined. It now avoids falling back to the loop root node when handling a VEC_PERM node that does not have a representative. Instead, it uses the region's entry block to more accurately identify the loop context, which is crucial for correct SLP vectorization decisions.
- SLP Vectorization
- Short-Loop-as-Parallel, a specific type of vectorization in GCC that identifies and vectorizes sequences of identical operations within basic blocks, even if they are not part of a traditional loop. It operates on the GIMPLE Intermediate Representation (IR).
- VEC_PERM
- An intermediate representation (IR) construct in GCC's tree-ssa system that represents a vector permutation operation. This operation rearranges elements within a vector. VEC_PERM nodes are often part of vectorization transformations.
- Loop root node
- In the context of compiler optimization, the loop root node typically refers to the entry block of a loop structure. It's the primary block from which the loop begins its execution.
- Region entry block
- The first basic block within a defined region of code. In the context of SLP vectorization, this likely refers to the entry point of a sequence of operations being considered for vectorization.