https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111364
Bug ID: 111364 Summary: `MAX_EXPR<a, b> <= a` is not optimized to `a >= b` Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: tree-optimization Assignee: pinskia at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- I Noticed this while looking into PR 111346: ``` _Bool test2(int a, int b) { int t = a; if (t < b) t = b; return t <= a; } ``` Should be optimized to just: ``` return a >= b; ``` There is a pattern for constants: /* MIN (X, C1) < C2 -> X < C2 || C1 < C2 */ But we could do the same when we know C1 == C2 and not constant (for !HONOR_NANS & !HONOR_SIGNED_ZEROS).