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

tree-optimization: Avoid incorrect restrict info on vectorized references

Ensures restrict qualifiers are correctly handled for vectorized memory references.

This commit enhances the vectorizer’s handling of restrict qualifiers for memory references. It introduces a check to compare restrict information across data reference groups before copying it to a vector reference. This prevents incorrect restrict information from being propagated when vectorizing memory accesses, ensuring more accurate alias analysis and potentially better optimization. The approach mirrors how type-based alias analysis (TBAA) information is handled.

In Details

The vectorizer's data reference handling in tree-vect-data-refs.cc and tree-vect-stmts.cc has been updated to ensure consistency of restrict qualifiers within a data reference (DR) group before copying. The vect_copy_ref_info function now takes stmt_vec_info as a source and verifies that the restrict properties are uniform across the group. This addresses PR128714, where incorrect restrict information could lead to faulty vectorization decisions. The changes align with existing practices for handling TBAA information and are designed for backporting.

For Context
restrict
A C/C++ qualifier that provides a promise to the compiler that a pointer is the sole initial means of accessing a particular object, aiding optimization by improving alias analysis.
vectorizer
A GCC optimization pass that transforms scalar code into vector code, utilizing SIMD instructions to process multiple data elements in parallel.
data reference
In the context of vectorization, a representation of a memory access (load or store) that the vectorizer analyzes.
alias analysis
The process by which a compiler determines whether different memory references might point to the same memory location.
TBAA
Type-Based Alias Analysis, an optimization technique that uses type information to infer whether different pointers can alias.
Filed Under: tree-optimizationvectorizationrestrictalias analysis