GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
tree-optimization Performance Win

SLP vectorizer handles returns-twice calls on entry

SLP vectorizer now correctly handles cases where a vectorization region starts with a call that returns twice.

The SLP vectorizer in GCC has been updated to correctly handle a specific edge case. Previously, if a vectorization candidate region began with a ‘returns-twice’ call (a call that can return to more than one instruction), the vectorizer would incorrectly attempt to insert code before it. This change modifies the insert_seq_on_entry function to advance past such calls, ensuring that vectorization occurs only when appropriate and preventing incorrect code generation.

In Details

The vec_info::insert_seq_on_entry function in the tree-vectorizer is responsible for setting up vectorization sequences. This commit addresses an issue where it would incorrectly attempt to insert a sequence before a block containing a returns-twice call. Such calls cannot be vectorized, so the iterator now advances past them, ensuring that the SLP (Superword Level Parallelism) vectorizer correctly identifies and processes vectorizable code following such calls.

Filed Under: optimizationvectorization