Landing: 6e33c9be872c

Project / Subsystem

gcc / tree-optimization

Date

2026-09-15

Author

Richard Biener

Commit

6e33c9be872cc7d2474b4224d1a16515e1b0d2b8

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
tree-optimization
patch_id
—
commit_hash
6e33c9be872cc7d2474b4224d1a16515e1b0d2b8
source_type
github
headline
tree-optimization/126760 - Fix vectorization of switches
tldr
Corrects CFG shape check for switch statement vectorization after if-conversion.
author
Richard Biener
outcome
committed
performance_win
false
breaking_change
false
series_id
—
series_parts
[]
tags
  • • vectorization
  • • optimization
  • • switch statement
  • • bugfix
discussion_id_link
—
bugzilla_pr
—
date
2026-09-15T00:00:00.000Z

This commit fixes a bug in GCC’s vectorization of switch statements that are converted using if-conversion. The check if_convertible_switch_p was incorrectly elided for blocks dominating loop latches, leading to faulty conversion. The fix delays the switch validation until the loop iterating over PHIs, ensuring correct CFG shape analysis and enabling reliable vectorization for such constructs, addressing PRs tree-optimization/126760 and tree-optimization/127391.