https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109959
Bug ID: 109959 Summary: `(a > 1) ? 0 : (a == 1)` is not optimized when spelled out Product: gcc Version: 14.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: ``` _Bool f(unsigned a) { if (a > 1) return 0; return a == 1; } _Bool f0(unsigned a) { return (a > 1) ? 0 : (a == 1); } ``` Both of these should just optimize to: `return a == 1`, f0 is currently.