https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95926
Bug ID: 95926 Summary: Failure to optimize xor pattern when Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: gabravier at gmail dot com Target Milestone: --- bool f(bool a, bool b) { bool tmp = a & b; return (tmp ^ b) | (tmp ^ a); } This code does not optimize as well as this code : bool f(bool a, bool b) { return ((a & b) ^ b) | ((a & b) ^ a); } which optimizes to `return a ^ b;`. This seems rather odd considering that they are equivalent and the first example is just a simplification of the second (i.e. made more readable).