Landing: 2ae9740dde82

Project / Subsystem

gcc / tree-optimization

Date

2026-10-02

Author

Richard Biener

Commit

2ae9740dde8225371d3791a71b99d52ef686e2cc

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
tree-optimization
patch_id
—
commit_hash
2ae9740dde8225371d3791a71b99d52ef686e2cc
source_type
github
headline
tree-optimization: Fix missed FRE in loop
tldr
Improves loop optimizations by ensuring FRE does not abort prematurely on PHI nodes in CFG cycles.
author
Richard Biener
outcome
committed
performance_win
true
breaking_change
false
series_id
—
series_parts
[]
tags
  • • optimization
  • • loop
  • • bugfix
discussion_id_link
—
bugzilla_pr
—
date
2026-10-02T00:00:00.000Z

This commit fixes a missed optimization in the Free Register Elimination (FRE) pass for loops. A previous correctness fix caused FRE to incorrectly abort when encountering a loop PHI node within a control flow graph (CFG) cycle. The change modifies the maybe_skip_until function to stop the traversal when it revisits the original PHI node, allowing constant propagation and avoiding the bug.