https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112266
Bug ID: 112266 Summary: `constcall(a)` and `constcall(&a->b[0])` is not being optimized to one call 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: ``` struct a { int b[1]; }; [[gnu::const]] int constcall(int *a); int f(struct a *b) { int *c = b->b; int *d = (int*)b; int t = constcall(c); int t1 = constcall(d); return t+t1; } ``` There should only be one call to constcall since the argument is the exact same value just represented slightly different in the IR.