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

ICE in vectorizable_lane_reducing fixed by handling analysis failure.

Fixes an internal compiler error by properly handling failures in vectorization analysis for lane-reducing operations.

This commit resolves an Internal Compiler Error (ICE) that occurred when analyzing lane-reducing reductions for vectorization. The issue arose because vect_get_num_copies_for_invariant would assert failure instead of returning an error code when it could not determine the number of copies. The analysis later relied on this information for costing, leading to the ICE. The fix ensures that the vectorizable_lane_reducing function fails early and gracefully when vect_get_num_copies_for_invariant encounters an issue, preventing the ICE and improving robustness for PR 127190.

In Details

The vectorizable_lane_reducing function in tree-vect-loop.cc is modified to handle the case where vect_get_num_copies_for_invariant fails. Previously, this helper function would assert if it could not determine the number of copies for a lane-reducing operation. Since vectorizable_lane_reducing uses this count for costing, the assertion led to an ICE. The change makes vectorizable_lane_reducing return failure when vect_get_num_copies_for_invariant does, addressing PR 127190.

For Context
Internal Compiler Error (ICE)
An unrecoverable error that occurs within the compiler itself, indicating a bug in the compiler's logic or internal state. It typically halts the compilation process.
vectorization
An optimization technique that allows the compiler to perform the same operation on multiple data elements simultaneously using special vector instructions (SIMD).
lane-reducing reduction
A type of reduction operation within a vector loop where intermediate results are combined across different lanes (elements) of a vector register. For example, summing elements across lanes.
vect_get_num_copies_for_invariant
A GCC internal function used during vectorization analysis to determine how many copies of an invariant value are needed for a specific operation.
Filed Under: optimizationvectorizationICE