https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112627
Bug ID: 112627 Summary: `(a + c) - b == c` is not optimized to `a == b` 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: ``` int f(int a, int b, int c) { return (a + c) - b == c; } int f1(int a, int b, int c) { return (a + 1) - b == 1; } ``` GCC can optimize f1 but not f. Note f1 is only optimized at the RTL level even.