GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
vect Performance Win

vect: Fix loop exit profiles with early break

Vectorizer now corrects inaccurate loop exit profile counts caused by early breaks.

The vectorizer has been modified to correct inaccurate loop exit profile information that arises when loops terminate early due to a break statement. Previously, the vectorizer could introduce incorrect counts in the control flow graph, leading to suboptimal optimizations. This patch ensures the vectorizer itself fixes these profile inaccuracies, rather than relying on other passes. This improves the accuracy of profile-guided optimizations for loops with early exit conditions.

In Details

This patch addresses inaccuracies in loop exit profiling introduced by the vectorizer when early exits (e.g., via break) are present. The vectorizer's transformation can distort the count of loop iterations, particularly for the exit edge. Instead of relying on other passes to fix these counts, this commit modifies the vectorizer to adjust them directly. This is part of a larger effort to improve profile accuracy across multiple compiler passes, ensuring that profile-guided optimizations are based on realistic execution counts, especially for code with complex control flow like early loop t…

For Context
vectorizer
A compiler pass that transforms loops operating on scalar values into loops operating on multiple data elements simultaneously (vectors), often leading to significant performance improvements on suitable hardware.
loop exit profile
Information about how often different exit paths from a loop are taken, used by profile-guided optimization (PGO) to make better decisions.
control flow graph (CFG)
A representation of all execution paths within a program, showing basic blocks and the branches between them. Profile data is often associated with edges in the CFG.
early break
A break statement within a loop that causes the loop to terminate prematurely, before all iterations are completed.
Filed Under: vectorizationoptimizationprofile-guided optimization