Landing: 1a787fd3dfef

Project / Subsystem

gcc / gcc

Date

2026-01-05

Author

liuhongt

Commit

1a787fd3dfefc8827d3e4289ae7bbaf18934bcd2

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
gcc
patch_id
commit_hash
1a787fd3dfefc8827d3e4289ae7bbaf18934bcd2
source_type
github
headline
Limit outer-loop unswitching by duplicated code size
tldr
The compiler avoids excessive code duplication by limiting outer-loop unswitching based on duplicated code size.
author
liuhongt
outcome
committed
performance_win
false
breaking_change
false
series_id
series_parts
[]
tags
  • gcc
  • optimization
  • loop unswitching
discussion_id_link
bugzilla_pr
date
2026-01-05T00:00:00.000Z

GCC’s loop unswitching optimization now considers the code size impact of hoisting unswitch predicates from inner loops to outer loops. The compiler estimates the size of the duplicated outer-loop bodies and avoids unswitching if the size exceeds param_max_unswitch_insns, preventing excessive code growth. A new test case, gcc.dg/loop-unswitch-19.c, has been added to verify this.