Hi! Thanks for working on this.
On Wed, Jan 16, 2019 at 10:20:26AM -0500, David Malcolm wrote: > PR target/88861 reports an ICE in "ce2" due to an unreachable > basic block. > > The block becomes unreachable in "combine" when delete_noop_moves > deletes an insn with a REG_EH_REGION, deleting the EH edge, the > only edge leading to the basic block. > > Normally, rest_of_handle_combine would call cleanup_cfg, deleting > unreachable blocks, if combine_instructions returns true, and > combine_instructions does return true for some cases of edge-removal, > but it doesn't for this case, leading to the ICE. > > This patch updates delete_noop_moves so that it returns true if > it deletes any edges, and passes that through to combine_instructions, > so that it too will return true if any edges were deleted, ensuring that > cleanup_cfg will be called by rest_of_handle_combine for this case, > deleting the now-unreachable block, and fixing the ICE. > -/* Delete any insns that copy a register to itself. */ > +/* Delete any insns that copy a register to itself. > + Return true if any edges are eliminated. */ "if the CFG was changed" or similar text? > -static void > +static bool > delete_noop_moves (void) > { > rtx_insn *insn, *next; > basic_block bb; > > + bool edges_deleted = false; > + > FOR_EACH_BB_FN (bb, cfun) > { > for (insn = BB_HEAD (bb); insn != NEXT_INSN (BB_END (bb)); insn = next) > @@ -1001,10 +1004,11 @@ delete_noop_moves (void) > if (dump_file) > fprintf (dump_file, "deleting noop move %d\n", INSN_UID (insn)); > > - delete_insn_and_edges (insn); > + edges_deleted |= delete_insn_and_edges (insn); > } > } > } Empty line here, too, please. > + return edges_deleted; > } > /* Main entry point for combiner. F is the first insn of the function. > NREGS is the first unused pseudo-reg number. > > - Return nonzero if the combiner has turned an indirect jump > - instruction into a direct jump. */ > + Return nonzero if any edges have been removed (e.g. if the combiner has > + turned an indirect jump instruction into a direct jump). */ "if the CFG was changed", again. > static int > combine_instructions (rtx_insn *f, unsigned int nregs) Okay with that. Thanks! Segher