[Bug tree-optimization/112627] New: `(a + c) - b == c` is not optimized to `a == b`
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Nov 19 17:25:28 GMT 2023
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.
More information about the Gcc-bugs
mailing list