Landing: 6c1a23f4bfe2

Project / Subsystem

gcc / vect

Date

2026-07-13

Author

Cem Akgok

Commit

6c1a23f4bfe2403c12439c299064af557b317737

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
vect
patch_id
commit_hash
6c1a23f4bfe2403c12439c299064af557b317737
source_type
github
headline
Fix incorrect code generation with SLP IV reuse
tldr
Corrects vectorization of induction variables by ensuring proper validation before reusing them.
author
Cem Akgok
outcome
committed
performance_win
false
breaking_change
false
series_id
series_parts
[]
tags
  • vectorization
  • optimization
  • SLP
  • induction variable
discussion_id_link
bugzilla_pr
date
2026-07-13T00:00:00.000Z

This commit fixes a bug in the vectorization of induction variables (IVs) using the Superword-Level Parallelism (SLP) technique. The vectorizable_induction function previously reused IVs without fully validating that the scalar initial values and steps of the folded vector chunks matched their predecessors. This could lead to incorrect code generation. The fix ensures that IV reuse only occurs when these initial values and steps are identical, adding new tests to cover these scenarios.