Landing: f6f33ca83cb6

Project / Subsystem

gcc / gcc/match.pd

Date

2026-05-01

Author

Daniel Barboza

Commit

f6f33ca83cb6b84cc5d157103ac70c143011b176

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
gcc/match.pd
patch_id
commit_hash
f6f33ca83cb6b84cc5d157103ac70c143011b176
source_type
github
headline
Match.pd: Make `if (c) a |= CST1 else a &= ~CST1` unconditional.
tldr
The compiler transforms conditional bit setting/clearing into an unconditional form, potentially improving performance.
author
Daniel Barboza
outcome
committed
performance_win
true
breaking_change
false
series_id
series_parts
[]
tags
  • optimization
  • branch removal
  • bit manipulation
discussion_id_link
bugzilla_pr
date
2026-05-01T00:00:00.000Z

The compiler now transforms code of the form if (c) a |= CST1 else a &= ~CST1 into an unconditional equivalent: (a & ~CST1) | (cond * CST1). This eliminates the conditional branch, which can improve performance. The transformation is only applied when the type size is less than or equal to the machine’s word size to avoid wide integer multiplications.