Landing: bb1344be44e3

Project / Subsystem

gcc / tree-vectorizer

Date

2026-08-19

Author

Richard Biener

Commit

bb1344be44e364da8377603697933a668b651c4e

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
tree-vectorizer
patch_id
—
commit_hash
bb1344be44e364da8377603697933a668b651c4e
source_type
github
headline
Decide vectorization factor (VF) independently of externals/constants.
tldr
Improves vectorization by basing the vectorization factor on assigned types, not external/constant node properties.
author
Richard Biener
outcome
committed
performance_win
true
breaking_change
false
series_id
—
series_parts
[]
tags
  • • tree-vectorizer
  • • optimization
  • • SLP
  • • performance
discussion_id_link
—
bugzilla_pr
—
date
2026-08-19T00:00:00.000Z

This commit refactors the SLP vectorizer to determine the vectorization factor (VF) based on the assigned SLP_TREE_VECTYPE rather than relying on max_nunits in the SLP graph, which previously included external and constant nodes. These external/constant nodes could artificially inflate the VF, leading to missed optimizations. By decoupling VF calculation from these nodes, the vectorizer can now select a more appropriate VF, resolving issues like ICEs in vect_get_num_copies and improving vectorization efficiency, particularly for code involving invariant data.