https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113964
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|repeat copy of struct |[11/12/13/14/15 Regression] | |repeat copy of struct Known to fail| |4.6.4, 4.7.1, 4.9.0, 5.1.0 Known to work| |4.1.2, 4.4.7, 4.5.3 Last reconfirmed| |2024-02-17 Target Milestone|--- |11.5 Keywords| |missed-optimization Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Confirmed. There is no DSE before esra .... And ESRA goes wrong because of that. Before ESRA we have: ``` _1 = e.f0.f4; _2 = (unsigned char) _1; e.f3 = _2; e.f0 = g_50; g_16 = MEM[(const struct S1 &)&e]; ``` And SRA thinks it should do: ``` Created a replacement for e offset: 0, size: 8: e$f3D.4642 Created a replacement for e offset: 192, size: 32: e$f0$f4D.4643 ``` But the store to e.f3 is dead due to the store to e.f0. I suspect this should be defered until GCC 15 and maybe we should try to reorg the optimization pipeline there ...