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

Handle missing vector mask types for SIMD clones

Prevents crashes when vectorizing loops with missing mask types.

This patch prevents crashes in the vectorizer when a loop uses partial vectorization with masked SIMD clones, and the target lacks a suitable vector mask type for scalar integer masks. Previously, a NULL tree could be passed to vect_record_loop_mask, causing a crash. The fix now checks for a valid mask type and disables partial vectors if none is found, ensuring stability. It also adds an assertion to catch such issues earlier.

In Details

When vectorizing loops with partial vector usage and masked SIMD clones, get_related_vectype_for_scalar_type might return NULL_TREE if the target lacks a specific vector mode (e.g., V2SF on 32-bit x86 for a scalar integer mask). Passing this NULL_TREE to vect_record_loop_mask caused an ICE in hash-set.h. This commit modifies vectorizable_simd_clone_call in tree-vect-stmts.cc to detect this condition, disable partial vectors if no suitable mask type is found, and adds an assertion in vect_record_loop_mask to ensure the vectype is non-null, improving robustness.

For Context
SIMD clone
A version of a loop or function generated by the compiler that uses SIMD instructions for parallel processing of multiple data elements.
mask type
In SIMD programming, a data type used to control which elements of a vector operation are active or updated.
ICE
Internal Compiler Error. An unrecoverable error during compilation that indicates a bug within the compiler itself.
Filed Under: optimizationvectorizationbugfixsimd