Landing: 7f6a999da640

Project / Subsystem

gcc / match.pd

Date

2026-08-15

Author

Shivam Gupta

Commit

7f6a999da640a9d33fa8d572c805884eeaac2935

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
match.pd
patch_id
—
commit_hash
7f6a999da640a9d33fa8d572c805884eeaac2935
source_type
github
headline
Simplify XORs of zero/one-valued comparisons
tldr
Compiler optimization pattern simplifies boolean XOR and equality expressions involving comparisons to zero, improving code efficiency.
author
Shivam Gupta
outcome
committed
performance_win
true
breaking_change
false
series_id
—
series_parts
[]
tags
  • • optimization
  • • boolean-logic
  • • compiler-internals
discussion_id_link
—
bugzilla_pr
—
date
2026-08-15T00:00:00.000Z

The compiler’s pattern matching system (match.pd) has been enhanced to simplify complex boolean expressions involving XOR and equality operations on comparisons with zero. It can now transform patterns like (a == 0) ^ (b != 0) into simpler equivalent forms such as a == b, leading to more efficient generated code by reducing redundant comparisons and operations.