https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109986
Bug ID: 109986
Summary: missing fold (~a | b) ^ a => ~(a & b)
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: vanyacpp at gmail dot com
Target Milestone: ---
int foo(int a, int b)
{
return (~a | b) ^ a;
}
This can be optimized to `return ~(a | b);`. This transformation is done by
LLVM, but not by GCC.
