https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90273
--- Comment #19 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> --- (In reply to Richard Biener from comment #18) > (In reply to rsand...@gcc.gnu.org from comment #17) > > Created attachment 46261 [details] > > Doing the removal in find_obviously_necessary_stmts > > > > Just for the record: I'd written this over the weekend for completely > > unrelated reasons (was looking at debug info, and wanted to replicate the > > DCE that is already done in RTL). It doesn't include the DEBUG_EXPR_DECL > > stuff, so obviously can't go in as-is, but it means that we never even add > > the redundant instructions to the worklist. > > Yeah, that looks nearly equivalent (same issue with DEBUG_EXPR_DECLs though). > > I think doing it in eliminate_unnecessary_stmts is slightly better for the > case where we come from > > # DEBUG i => NULL; > i_3 = 1; > # DEBUG i => i_3; > > and are about to DCE i_3 Ah, yeah.