Landing: 0621cf67366f

Project / Subsystem

gcc / middle-end

Date

2026-08-09

Author

Kael Andrew Alonzo Franco

Commit

0621cf67366ffa2215cdd081b1ca1c3c577e8b70

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
middle-end
patch_id
—
commit_hash
0621cf67366ffa2215cdd081b1ca1c3c577e8b70
source_type
github
headline
middle-end: Wrong code for a != b | (a|b) != 0. [PR126742]
tldr
Fixes incorrect optimization of bitwise operations involving inequality checks.
author
Kael Andrew Alonzo Franco
outcome
committed
performance_win
false
breaking_change
false
series_id
—
series_parts
[]
tags
  • • optimization
  • • bugfix
  • • middle-end
discussion_id_link
—
bugzilla_pr
—
date
2026-08-09T00:00:00.000Z

This commit corrects a flawed optimization in GCC’s middle-end related to bitwise operations. The compiler was incorrectly simplifying expressions like (a != b) | ((a|b) != 0) to ((a|b) == 0). The correct logical equivalence is (a != b) | ((a|b) != 0) simplifies to ((a|b) != 0). A test case was updated to more rigorously check the generated code for this specific pattern.