Avoid SSA copies from vect_add_slp_permutation.
Vectorizer no longer creates unnecessary SSA copies when vector permutations are readily available.
This commit refactors the GCC vectorizer’s SLP (Sliding-window Pattern) pass to eliminate unnecessary SSA copies. Previously, a stmt_vec_info was required for all vector definitions, leading to extra copies even when the vector extraction was directly available. The changes in tree-vect-slp.cc remove this requirement and improve handling of default definitions and constants within vector definitions.
In Details
The vect_add_slp_permutation function in tree-vect-slp.cc previously enforced the creation of a stmt_vec_info for every vector definition, necessitating an SSA copy even when the desired vector extraction was already available. This commit removes that strict requirement. It also refactors vect_schedule_slp_node to correctly handle cases where default definitions or constants are used in vector definitions, avoiding unnecessary intermediate SSA values.
- SSA
- Static Single Assignment. An intermediate representation form in compilers where every variable is assigned a value exactly once. This simplifies many optimization and analysis passes.
- vectorizer
- A component of a compiler that automatically transforms scalar code into equivalent vector code, enabling parallel execution on multiple data elements simultaneously.
- SLP
- Sliding-window Pattern. A vectorization technique that identifies and groups similar scalar operations that can be executed in parallel on vector registers.
- stmt_vec_info
- A data structure used within GCC's vectorizer to store information about a statement relevant to vectorization, such as its properties, dependencies, and potential for parallel execution.