https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111168
Bug ID: 111168 Summary: a[0,1]|b[0,-1] == 0 is not reduced to a ==0 & b ==0 if a and b are defined by comparisons 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: ``` static inline int comLG_(int a, int b) { int c = (a < b) * -1; return (a > b) | c; } int f(int a, int b) { return comLG_(a,b) == 0; } ``` This should be reduced down to just `(a < b) == 0 & (a > b) == 0` or rather just `a == b`.