Verify SLP schedule also for PHIs
Ensures SLP vectorizer correctly handles PHI nodes in scheduled code.
This commit enhances the SLP (Sliding Window Parallelization) vectorizer to correctly verify scheduling for PHI nodes. It ensures that the insertion place of the schedule dominates the PHI argument edges. This fix prevents potential issues with vectorization when PHI nodes are involved and includes a new test case.
In Details
The vect_schedule_slp_node function in tree-vect-slp.cc is responsible for scheduling basic blocks for SLP vectorization. This change adds a verification step to ensure that the scheduled position dominates all incoming edges to PHI nodes within the block. This is crucial because PHI nodes merge values from different control flow paths, and their operands must be available at the point of the PHI.
- SLP
- Sliding Window Parallelization, a compiler optimization technique that identifies and vectorizes independent instructions within a basic block by treating them as a 'sliding window'.
- PHI node
- In SSA (Static Single Assignment) form, a PHI node is used to merge values from different control flow paths. It represents a value that could have come from one of several predecessors.