Landing: 656bb1d9e963

Project / Subsystem

gcc / gcc/match.pd

Date

2026-08-11

Author

Daniel Barboza

Commit

656bb1d9e9637028f917310e6c7688a0f1e99758

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
gcc/match.pd
patch_id
—
commit_hash
656bb1d9e9637028f917310e6c7688a0f1e99758
source_type
github
headline
Simplify conditional bitwise OR patterns involving bitmasks.
tldr
Compiler patterns now simplify more conditional bitwise OR operations.
author
Daniel Barboza
outcome
committed
performance_win
true
breaking_change
false
series_id
—
series_parts
[]
tags
  • • optimization
  • • pattern matching
  • • bitwise operations
discussion_id_link
—
bugzilla_pr
—
date
2026-08-11T00:00:00.000Z

This commit expands the match.pd patterns to unconditionally simplify more conditional bitwise OR operations. It introduces new patterns to handle cases where a bit is checked and then set if not present, or where a bitmask is tested against itself. These simplifications apply when the bit is derived from a left shift (e.g., 1 << val) or when a full bitmask is involved, allowing the compiler to replace conditional logic with direct bitwise OR operations, thereby improving code efficiency.