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

Use LOOP_VINFO_MAIN_EXIT for final IV edge in vectorizer.

Vectorizer now uses a more appropriate exit condition for final loop invariants.

The GCC vectorizer has been updated to use LOOP_VINFO_MAIN_EXIT instead of exit_edge when determining the final invariant for peeled loops. This change corrects how the loop condition is updated, ensuring more accurate vectorization.

This fix addresses a specific issue related to loop peeling and invariant handling within the tree-vectorization pass.

In Details

The vect_set_loop_condition_partial_vectors_avx512 and vect_set_loop_condition_normal functions in tree-vect-loop-manip.cc previously used exit_edge for updating the final invariant of peeled loops. This commit changes the logic to use LOOP_VINFO_MAIN_EXIT, which is a more precise way to denote the main exit of a loop's vector information. This change ensures that the loop condition is correctly established for peeled iterations, particularly relevant for AVX512 vectorization strategies.

Filed Under: vectorizationloop optimization