> 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?

Revised version attached.

-- 
Eric Botcazou
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index f05cb6136c7..f49a34dcb0f 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -2134,18 +2134,15 @@ try_crossjump_to_edge (int mode, edge e1, edge e2,
   update_br_prob_note (redirect_edges_to);
 
   /* Edit SRC1 to go to REDIRECT_TO at NEWPOS1.  */
-
-  /* Skip possible basic block header.  */
   if (LABEL_P (newpos1))
     newpos1 = NEXT_INSN (newpos1);
 
-  while (DEBUG_INSN_P (newpos1))
-    newpos1 = NEXT_INSN (newpos1);
-
-  if (NOTE_INSN_BASIC_BLOCK_P (newpos1))
-    newpos1 = NEXT_INSN (newpos1);
-
-  while (DEBUG_INSN_P (newpos1))
+  /* Skip debug insns, basic block header and prologue markers.  */
+  while (DEBUG_INSN_P (newpos1)
+	 || (NOTE_P (newpos1)
+	     && (NOTE_KIND (newpos1) == NOTE_INSN_BASIC_BLOCK
+		 || NOTE_KIND (newpos1) == NOTE_INSN_PROLOGUE_END
+		 || NOTE_KIND (newpos1) == NOTE_INSN_FUNCTION_BEG)))
     newpos1 = NEXT_INSN (newpos1);
 
   redirect_from = split_block (src1, PREV_INSN (newpos1))->src;

Reply via email to