forwprop: do not splat an abnormal SSA name at a CONSTRUCTOR
Fixes an out-of-SSA bug related to vector constructors and abnormal PHI nodes.
This commit addresses an out-of-SSA bug occurring when the forwprop pass encounters vector CONSTRUCTOR expressions involving SSA names from abnormal PHI nodes. Previously, if a uniform vector element was an SSA name from an abnormal PHI and redefined before the CONSTRUCTOR, the live ranges of the two SSA versions would overlap, causing the out-of-SSA transformation to fail. The fix prevents the simplify_vector_constructor from ‘splatting’ such SSA names, thus resolving the live-range conflict and enabling optimizations like SLP vectorization on affected platforms.
In Details
This patch resolves an out-of-SSA issue in tree-ssa-forwprop.cc related to simplify_vector_constructor. The problem arises when a uniform vector element is an SSA name originating from an abnormal PHI node, and this SSA name is redefined before the CONSTRUCTOR expression. The simplify_vector_constructor pass erroneously creates a 'splat' (replication) of the scalar SSA name within the CONSTRUCTOR, extending its live range and causing conflicts with the original definition. The fix modifies simplify_vector_constructor to avoid this splatting when the element is an SSA name from an…
- forwprop
- Forward Propagation, a compiler optimization pass that replaces variables with their values where possible, simplifying expressions and enabling further optimizations.
- SSA
- Static Single Assignment, an intermediate representation property where each variable is assigned a value exactly once. This simplifies many compiler analyses and optimizations.
- PHI node
- In SSA form, a PHI node is used at the join of control flow paths to merge values from different predecessors, indicating which value to use based on the path taken.
- CONSTRUCTOR
- In GCC's internal representation (GIMPLE/Tree), this represents the initialization of an aggregate type, such as a structure or an array, often used for vector types.
- abnormal PHI
- A PHI node that violates certain properties expected by the standard SSA transformation, often arising from complex control flow or specific compiler optimizations.
- out-of-SSA
- A state where the compiler's intermediate representation temporarily violates the Static Single Assignment property, typically during transformations that require multiple assignments to the same conceptual variable.
- SLP
- Superword Level Parallelism, a compiler optimization technique that identifies sequences of identical operations on scalars and combines them into a single operation on vectors.