On Wed, May 05, 2021 at 01:00:35PM +0200, Eric Botcazou wrote: > 2021-05-05 Eric Botcazou <ebotca...@adacore.com> > > PR rtl-optimization/100411 > * cfgcleanup.c (try_crossjump_to_edge): Also skip end of prologue > and beginning of function markers. > > -- > Eric Botcazou
> diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c > index f05cb6136c7..64279cc8c20 100644 > --- a/gcc/cfgcleanup.c > +++ b/gcc/cfgcleanup.c > @@ -2148,6 +2148,20 @@ try_crossjump_to_edge (int mode, edge e1, edge e2, > while (DEBUG_INSN_P (newpos1)) > newpos1 = NEXT_INSN (newpos1); > > + /* And end of prologue marker. */ > + if (NOTE_P (newpos1) && NOTE_KIND (newpos1) == NOTE_INSN_PROLOGUE_END) > + newpos1 = NEXT_INSN (newpos1); > + > + while (DEBUG_INSN_P (newpos1)) > + newpos1 = NEXT_INSN (newpos1); > + > + /* And also beginning of function marker. */ > + if (NOTE_P (newpos1) && NOTE_KIND (newpos1) == NOTE_INSN_FUNCTION_BEG) > + newpos1 = NEXT_INSN (newpos1); > + > + while (DEBUG_INSN_P (newpos1)) > + newpos1 = NEXT_INSN (newpos1); Do those notes always have to appear in that order? I mean, can't we have just one while loop that skips over all debug insns, NOTE_INSN_BASIC_BLOCK_P, NOTE_INSN_PROLOGUE_END and NOTE_INSN_FUNCTION_BEG and stops on anything else, or, if we want to skip at most one of some or all of those note kinds, do some tracking if we've already skipped that kind of note? > + > redirect_from = split_block (src1, PREV_INSN (newpos1))->src; > to_remove = single_succ (redirect_from); > Jakub