MONDAY, AUGUST 24, 2026
tree-optimization Performance Win
SLP scheduling respects trapping statements
SLP vectorization now correctly handles statements that might trap, preventing incorrect scheduling and ICEs.
The SLP (Superword-Level Parallelism) scheduler in GCC now correctly respects constraints imposed by potentially trapping statements. This prevents SLP from scheduling instructions after a trapping statement if that statement dominates the schedule point, fixing an ICE and improving the robustness of vectorization.
In Details
The vect_schedule_slp_node function in tree-vect-slp.cc has been updated to maintain scheduling when the target schedule point is dominated by a trapping statement. This addresses a bug (PR126995) where SLP scheduling could lead to an ICE by incorrectly reordering instructions around statements that might raise exceptions.
For Context
- SLP
- Superword-Level Parallelism, a compiler optimization technique that identifies and vectorizes consecutive instructions with identical operations on different data elements.
- ICE
- Internal Compiler Error, a fatal error encountered by the compiler during translation, typically indicating a bug in the compiler itself.
- vectorization
- An optimization process that transforms code to operate on multiple data elements simultaneously using special CPU instructions (SIMD), often improving performance for data-parallel tasks.
- trapping statement
- A statement or instruction that, if executed, may cause an exception or trap, interrupting normal program flow. Examples include division by zero or accessing invalid memory.