https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385
--- Comment #26 from Jakub Jelinek <jakub at gcc dot gnu.org> --- For debug stmts, it would be best if we could use those DEBUG D#Y s=> parm DEBUG var => D#Y added in if (param_body_adjs && MAY_HAVE_DEBUG_BIND_STMTS). Though, if we remove already during the copy_bb by not actually creating the stmt, I'm afraid that will mean the debug info is lost (debug stmts will be reset), unless we for the lhs of to be dced stmts manually create debug temporaries and debug stmts when we remap_gimple_stmt those stmts (for SSA_NAMEs that are directly (or indirectly!) used in debug stmts). If we do what Martin was proposing instead, i.e. copy the stmts and then DCE them afterwards, it might work properly (perhaps only if we DCE them in the right order).