Landing: f4b5c2bf40d6

Project / Subsystem

gcc / gcc/match

Date

2026-03-26

Author

Pengxuan Zheng

Commit

f4b5c2bf40d68e1666c83556a236a53cdddc34a2

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
gcc/match
patch_id
commit_hash
f4b5c2bf40d68e1666c83556a236a53cdddc34a2
source_type
github
headline
Match: Add simplifications for min/max comparisons.
tldr
The compiler can now simplify comparisons between min(a, b) and max(a, b) to true, false, a!=b, or a==b.
author
Pengxuan Zheng
outcome
committed
performance_win
true
breaking_change
false
series_id
series_parts
[]
tags
  • optimization
  • pattern-matching
  • min
  • max
discussion_id_link
bugzilla_pr
date
2026-03-26T00:00:00.000Z

New patterns were added to simplify comparisons between the results of min(a, b) and max(a, b). Specifically, expressions like min(a,b) <= max(a,b) will now reduce to true, min(a,b) > max(a,b) to false, min(a,b) < max(a,b) to a!=b, and min(a,b) >= max(a,b) to a==b. This can help later optimization passes by removing complexity early.