GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc

Make vect_build_slp_tree_3 re-callable.

Refactors SLP vectorization to make tree building re-entrant.

This change refactors the vect_build_slp_tree_3 function within GCC’s tree-vectorizer to be re-callable. It moves statement-local checks to occur before the comparison logic, ensuring that the result of building the SLP (Superword Level Parallelism) tree does not depend on the order in which statements are processed. This improves robustness for handling unsupported BIT_FIELD_REFs across all statements.

In Details

The vect_build_slp_tree_3 function in tree-vect-slp.cc was not safely re-entrant because statement-local checks were performed after initial comparisons. This commit moves these checks to occur before the comparison logic. Specifically, it ensures that unsupported BIT_FIELD_REFs are checked for all statements within the tree-building process, preventing the outcome from depending on whether a statement is processed first, thus making the function re-entrant.

For Context
SLP (Superword Level Parallelism)
A type of instruction-level parallelism where multiple independent data elements within a vector register are processed in parallel using SIMD (Single Instruction, Multiple Data) instructions.
tree-vectorizer
A GCC optimization pass that transforms scalar code into vector code to exploit SIMD capabilities of the target processor.
BIT_FIELD_REF
An internal GCC representation for accessing bitfields within a larger data type.
re-entrant
A property of a function or routine that allows it to be interrupted in the middle of its execution and then safely called again (or called by another thread) before its previous invocation completes. The interrupted invocation can then resume safely.
Filed Under: optimizationvectorizationSLP