https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97199
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- (gdb) p debug_gimple_stmt (phi) .MEM_104 = PHI <(4), .MEM_97(41)> so clearly bogus IL here. The issue is the virtual operand update in if-conversion combine_blocks which does /* We release virtual PHIs late because we have to propagate them out using the current VUSE. The def might be the one used after the loop. */ vphi = get_virtual_phi (bb); if (vphi) { /* When there's just loads inside the loop a stray virtual PHI merging the uses can appear, update last_vdef from it. */ if (!last_vdef) last_vdef = gimple_phi_arg_def (vphi, 0); but this doesn't work since we already removed all edges which clears the PHI arg defs.