https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122201
Bug ID: 122201
Summary: Missing removal of a load due to not doing
reassociation with signed integers
Product: gcc
Version: 16.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, int *d)
{
int t = *a;
t += *b;
t += *c;
t += *d;
t -= *a;
return t;
}
```
There should be no load from a but currently GCC is not able to optimize it out
due to not doing reassociation with signed integer.
This comes from C++ code with a few layers. and the re-association and removal
of the load needs to happen before inlining otherwise this important function
in this benchmark will not be inlined due to the size being too big.