https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80738
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu.org --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Created attachment 46491 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46491&action=edit broken prototype So I think DSE could try to handle this. When it sees *a = 0; _1 = *b; *a = _1; *b = 0; looking for uses of the first store it will arrive at the load from b. With looking at the immediate use(s) from _1 it could check whether it arrives at a store with the same VUSE that would look killing and if so disregard the use. The following implements this but it needs sanitizing for the case of possible partial overlaps... It also only looks at the immediate next stores and would be confused by intermediate unrelated ones.