Landing: 028b8b62979f

Project / Subsystem

gcc / cfgcleanup

Date

2026-09-11

Author

Kyrylo Tkachov

Commit

028b8b62979f7e6326cb15ec8e519b1600e86a36

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
cfgcleanup
patch_id
—
commit_hash
028b8b62979f7e6326cb15ec8e519b1600e86a36
source_type
github
headline
cfgcleanup: Keep computed goto predecessors apart for tail merging
tldr
Avoids merging computed goto predecessors, improving code size for some cases and enabling tail duplication.
author
Kyrylo Tkachov
outcome
committed
performance_win
true
breaking_change
false
series_id
—
series_parts
[]
tags
  • • optimization
  • • cfgcleanup
  • • aarch64
discussion_id_link
—
bugzilla_pr
—
date
2026-09-11T00:00:00.000Z

This change modifies the cfgcleanup pass to prevent tail merging for the predecessors of computed gotos. Previously, these tails were merged unconditionally, which interfered with the pass_duplicate_computed_gotos pass. By gating tail merging on the same condition as tail duplication (!optimize_function_for_size_p && flag_expensive_optimizations), this commit ensures that tail duplication can occur when beneficial. This results in smaller code size for certain computations and enables better optimization in specific scenarios, as demonstrated by aarch64 code size reductions.