Landing: ea8c74c07492

Project / Subsystem

gcc / match

Date

2026-06-30

Author

Andrew Pinski

Commit

ea8c74c074925b93f013519a63e3518e0c448b85

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
match
patch_id
commit_hash
ea8c74c074925b93f013519a63e3518e0c448b85
source_type
github
headline
match: Simplify `(a CMP1 b) AND/IOR (a CMP2 b)` [PR126042]
tldr
Compiler now simplifies combinations of comparisons using bitwise AND/IOR, improving optimization for floating-point and other comparisons.
author
Andrew Pinski
outcome
committed
performance_win
true
breaking_change
false
series_id
series_parts
[]
tags
  • optimization
  • match
  • floating-point
  • comparisons
discussion_id_link
bugzilla_pr
date
2026-06-30T00:00:00.000Z

This commit enhances GCC’s optimization capabilities by introducing a new pattern in match.pd to simplify expressions of the form (a CMP1 b) AND/IOR (a CMP2 b). It reuses the combine_comparisons logic from fold-cost.cc, enabling optimizations for various comparisons, including floating-point ones, especially when -fno-trapping-math is used. This change leads to more efficient code generation for complex conditional logic.