https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117760
Bug ID: 117760 Summary: `a != b` implies that a or b is also non-zero Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Take: ``` int f(int a, int b) { if (a != b) return a != 0 || b != 0; return 0; } ``` This should just reduce down to `return a != b;` as if a and b are non-equal implies one of them have to be non-zero as well as both can't be 0.