https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105577
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org Status|NEW |ASSIGNED --- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> --- So DSE does /* DSE can eliminate potentially-trapping MEMs. Remove any EH edges associated with them. */ if ((locally_deleted || globally_deleted) && cfun->can_throw_non_call_exceptions && purge_all_dead_edges ()) { free_dominance_info (CDI_DOMINATORS); cleanup_cfg (0); which should do the trick, but the fast-DCE is invoked via dse_step0 (); dse_step1 (); dse_step2_init (); if (dse_step2 ()) { df_set_flags (DF_LR_RUN_DCE); df_analyze (); and dse_step0/1 already removed the stores, exposing the bad IL. One way to fix this might be to run cleanup_cfg after dse_step1 already, or just remove_unreachable_blocks. I'm going to test diff --git a/gcc/dse.cc b/gcc/dse.cc index b8914a3ae24..bb658a85959 100644 --- a/gcc/dse.cc +++ b/gcc/dse.cc @@ -3682,6 +3682,16 @@ rest_of_handle_dse (void) dse_step0 (); dse_step1 (); + /* DSE can eliminate potentially-trapping MEMs. + Remove any EH edges associated with them, since otherwise + DF_LR_RUN_DCE will complain later. */ + if ((locally_deleted || globally_deleted) + && cfun->can_throw_non_call_exceptions + && purge_all_dead_edges ()) + { + free_dominance_info (CDI_DOMINATORS); + delete_unreachable_blocks (); + } dse_step2_init (); if (dse_step2 ()) {