Landing: 804ff22702ec

Project / Subsystem

gcc / phiopt

Date

2026-08-22

Author

Aldy Hernandez

Commit

804ff22702eca4e389e1a2f3659010190504a757

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
phiopt
patch_id
—
commit_hash
804ff22702eca4e389e1a2f3659010190504a757
source_type
github
headline
Replicate conditionals over a PHI of comparisons
tldr
Restores an optimization that replicates conditional logic over PHI nodes.
author
Aldy Hernandez
outcome
committed
performance_win
true
breaking_change
false
series_id
—
series_parts
[]
tags
  • • optimization
  • • phiopt
  • • control flow
discussion_id_link
—
bugzilla_pr
—
date
2026-08-22T00:00:00.000Z

This commit reintroduces an optimization in the phiopt pass that replicates conditional logic over a PHI node formed by comparisons. This optimization was lost during a rewrite of GCC’s jump threading machinery but was partially recovered by the DOM (Dominator) pass. The phiopt pass now handles these cases directly, improving performance by avoiding unnecessary conditional merges. The optimization is deliberately not applied to loop boundaries to preserve loop structure, though the DOM pass’s version remains available for such cases. This change recovers over 94% of the joins previously handled by DOM’s special case.