Landing: a9b19ded78ca
Project / Subsystem
gcc / tree-optimization
Date
2026-10-01
Author
Richard Biener
Commit
a9b19ded78ca2dd8f66b355b05ebbbb149c2d320
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- tree-optimization
- patch_id
- —
- commit_hash
- a9b19ded78ca2dd8f66b355b05ebbbb149c2d320
- source_type
- github
- headline
- Vector cost model heuristic misapplied when loop iteration count is constant
- tldr
- GCC's vectorizer will no longer wrongly assume vectorization is profitable for single-iteration loops when the iteration count is already known.
- author
- Richard Biener
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optimization
- • vectorization
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-10-01T00:00:00.000Z
GCC’s vectorizer uses a cost model heuristic that assumes vectorization is profitable even for loops that execute only once, provided the vector cost is cheap. However, this heuristic was being applied even when the loop’s iteration count was constant, a case already handled by a separate profitability assessment. This commit modifies the vector cost analysis to avoid applying the single-iteration heuristic when the iteration count is constant, preventing incorrect vectorization decisions.