Landing: ef09fd77d461

Project / Subsystem

gcc / match.pd

Date

2026-07-30

Author

Kyrylo Tkachov

Commit

ef09fd77d46188ec20ae2205dbf9258730668933

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
match.pd
patch_id
—
commit_hash
ef09fd77d46188ec20ae2205dbf9258730668933
source_type
github
headline
Simplify shift operations by dropping no-longer-needed bitwise operands
tldr
Compiler optimization removes redundant bitwise operations before shifts.
author
Kyrylo Tkachov
outcome
committed
performance_win
true
breaking_change
false
series_id
—
series_parts
[]
tags
  • • optimization
  • • compiler
  • • aarch64
discussion_id_link
—
bugzilla_pr
—
date
2026-07-30T00:00:00.000Z

A new simplification rule in match.pd allows the compiler to drop operands from bitwise XOR or OR operations when all their set bits are below the shift count. This optimization, inspired by real-world code where flag bits are packed into a word, improves generated code by eliminating unnecessary operations. The rule applies to both GENERIC and GIMPLE expressions and has been verified on aarch64.