https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61385
--- Comment #3 from Marc Glisse <glisse at gcc dot gnu.org> --- Ah, right, I use last_and_only_stmt (middle_bb) but that doesn't prove there are no PHI nodes there. Easiest fix, something like: if (!gimple_seq_empty_p (phi_nodes (middle_bb))) return 0; A better fix would be to move the PHI nodes from middle_bb to the same block as we are moving the assignment. I am just not completely sure how safe that is (or how to do that, but I'll probably find examples nearby).