https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101293
Bug ID: 101293 Summary: LIM ref canonicalization incomplete Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: rguenth at gcc dot gnu.org Target Milestone: --- We fail to apply store-motion to struct X { int i; int j; }; void foo(struct X *x, int n) { for (int i = 0; i < n; ++i) { int *p = &x->j; int tem = *p; x->j += tem * i; } } because we end up with two distinct memory references: Memory reference 1: MEM[(int *)x_7(D) + 4B] Memory reference 2: x_7(D)->j