Landing: c07fc7b5c698

Project / Subsystem

gcc / match

Date

2026-08-06

Author

Kyrylo Tkachov

Commit

c07fc7b5c69884adbfea21c3db08a9583f664377

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
match
patch_id
—
commit_hash
c07fc7b5c69884adbfea21c3db08a9583f664377
source_type
github
headline
Fold idioms involving negation and bitwise operations.
tldr
Compiler now recognizes and simplifies arithmetic idioms involving negation and bitwise operations for improved performance.
author
Kyrylo Tkachov
outcome
committed
performance_win
true
breaking_change
false
series_id
—
series_parts
[]
tags
  • • optimization
  • • pattern matching
discussion_id_link
—
bugzilla_pr
—
date
2026-08-06T00:00:00.000Z

The compiler’s pattern matching system has been enhanced to recognize and fold two arithmetic idioms that are built from the negation of a value. These optimizations, which involve combinations of addition, bitwise AND, and negation, can lead to more efficient code generation, particularly for operations like rounding up to the nearest power of two. The changes also include updates to test cases and ensure that the optimizations do not interfere with overflow sanitization.