https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99793
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org Status|UNCONFIRMED |ASSIGNED Version|unknown |11.0 Last reconfirmed| |2021-03-29 Keywords| |missed-optimization --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- So the difference is -fstrict-aliasing which causes us to not elide the redundant store to 'd' which in turn makes us fail to promote 'd' read-only: Value numbering stmt = d = d.2_2; -Store matched earlier value, value numbering store vdefs to matching vuses. -Setting value number of .MEM_9 to .MEM_8 (changed) -Deleted redundant store d = d.2_2; +No store match +Value numbering store d to d.2_2 +Setting value number of .MEM_9 to .MEM_9 (changed) and the issue is that we "optimize" part of the walking with recording last_vuse and using that vuse to insert the preceeding load into the hashtables but since the walking is different for redundant store detection (no TBAA), it cannot walk that far (beyond the non-TBAA aliasing store to *b) and thus it cannot find the hashtable entry of the d.2_2 = d load. The last-vuse trick is poor-mans "PRE" - I do remember experimenting with inserting both last and original vuse exprs but I do not remember the outcome.