https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122678
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Oh I had noticed this also in https://gcc.gnu.org/pipermail/gcc-patches/2024-September/663099.html (but I didn't think of it until now). Note the patch is slightly bigger than I had expected but that is because the order of removal is important for debug statements. You need to remove the assignment before the phi. Otherwise the result of the phi is still referenced in the debug statement :).
