https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105546
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- Created attachment 53729 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53729&action=edit patch to limit sinking I was playing with this, limiting sinking to two PHI nodes in this case but then with two passes we still get four stores sunk so it doesn't really help. out-of-SSA could do the reverse transform for expensive constant PHI args.