diff mbox

Replace REG_CROSSING_JUMP with an rtx flag

Message ID 87mweelrf8.fsf@talisman.default
State New
Headers show

Commit Message

Richard Sandiford May 18, 2014, 9:15 p.m. UTC
find_reg_note showed up in the profile of a -O2 compile of an oldish
fold-const.ii.  The main hot call was:

      /* If we are partitioning hot/cold basic_blocks, we don't want to mess
	 up jumps that cross between hot/cold sections.

	 Basic block partitioning may result in some jumps that appear
	 to be optimizable (or blocks that appear to be mergeable), but which
	 really must be left untouched (they are required to make it safely
	 across partition boundaries).  See the comments at the top of
	 bb-reorder.c:partition_hot_cold_basic_blocks for complete
	 details.  */

      if (first != EXIT_BLOCK_PTR_FOR_FN (cfun)
	  && find_reg_note (BB_END (first), REG_CROSSING_JUMP, NULL_RTX))
	return changed;

from try_forward_edges.  I suppose the immediate problem was that it
doesn't check specifically for blocks that end in jumps.  Applying it
to things like calls could involve a lot pointer chasing.

A 3-pointer reg note seems a bit heavyweight for a boolean anyway.
JUMP_INSNs have a quite a few unused rtx header flags (including "jump",
ironically) so this patch records the information there instead.

This reduces the compile time by about ~0.5%.  Not a huge amount,
but maybe it counts as a cleanup.

A neater fix would be to record this in the basic_block flags,
so that we don't even need to bring the jump into cache.
That would be tricky to keep up-to-date though.

Tested on x86_64-linux-gnu.  Also tested by building arc-elf and sh-elf
compilers and checking that there was no change in testsuite output for
gcc.dg, g++.dg and gcc-c-torture.  OK to install?

I wondered about converting REG_SETJMP too, but it probably only makes
sense to use up the flags for things that are known to benefit.

Thanks,
Richard


gcc/
	* reg-notes.def (CROSSING_JUMP): Likewise.
	* rtl.h (rtx_def): Update comment for jump flag.
	(CROSSING_JUMP_P): Define.
	* cfgcleanup.c (try_forward_edges, try_optimize_cfg): Use it instead
	of a REG_CROSSING_JUMP note.
	* cfghooks.c (tidy_fallthru_edges): Likewise.
	* cfgrtl.c (fixup_partition_crossing, rtl_verify_edges): Likewise.
	* emit-rtl.c (try_split): Likewise.
	* haifa-sched.c (sched_create_recovery_edges): Likewise.
	* ifcvt.c (find_if_case_1, find_if_case_2): Likewise.
	* jump.c (redirect_jump_2): Likewise.
	* reorg.c (follow_jumps, fill_slots_from_thread): Likewise.
	(relax_delay_slots): Likewise.
	* config/arc/arc.md (jump_i, cbranchsi4_scratch, *bbit): Likewise.
	(bbit_di): Likewise.
	* config/arc/arc.c (arc_reorg, arc_can_follow_jump): Likewise.
	* config/sh/sh.md (jump_compact): Likewise.
	* bb-reorder.c (rotate_loop): Likewise.
	(pass_duplicate_computed_gotos::execute): Likewise.
	(add_reg_crossing_jump_notes): Rename to...
	(update_crossing_jump_flags): ...this.
	(pass_partition_blocks::execute): Update accordingly.

Comments

Eric Botcazou May 18, 2014, 9:20 p.m. UTC | #1
> A 3-pointer reg note seems a bit heavyweight for a boolean anyway.
> JUMP_INSNs have a quite a few unused rtx header flags (including "jump",
> ironically) so this patch records the information there instead.
> 
> This reduces the compile time by about ~0.5%.  Not a huge amount,
> but maybe it counts as a cleanup.

Good catch!

> 	* reg-notes.def (CROSSING_JUMP): Likewise.
> 	* rtl.h (rtx_def): Update comment for jump flag.
> 	(CROSSING_JUMP_P): Define.
> 	* cfgcleanup.c (try_forward_edges, try_optimize_cfg): Use it instead
> 	of a REG_CROSSING_JUMP note.
> 	* cfghooks.c (tidy_fallthru_edges): Likewise.
> 	* cfgrtl.c (fixup_partition_crossing, rtl_verify_edges): Likewise.
> 	* emit-rtl.c (try_split): Likewise.
> 	* haifa-sched.c (sched_create_recovery_edges): Likewise.
> 	* ifcvt.c (find_if_case_1, find_if_case_2): Likewise.
> 	* jump.c (redirect_jump_2): Likewise.
> 	* reorg.c (follow_jumps, fill_slots_from_thread): Likewise.
> 	(relax_delay_slots): Likewise.
> 	* config/arc/arc.md (jump_i, cbranchsi4_scratch, *bbit): Likewise.
> 	(bbit_di): Likewise.
> 	* config/arc/arc.c (arc_reorg, arc_can_follow_jump): Likewise.
> 	* config/sh/sh.md (jump_compact): Likewise.
> 	* bb-reorder.c (rotate_loop): Likewise.
> 	(pass_duplicate_computed_gotos::execute): Likewise.
> 	(add_reg_crossing_jump_notes): Rename to...
> 	(update_crossing_jump_flags): ...this.
> 	(pass_partition_blocks::execute): Update accordingly.

OK, thanks.
diff mbox

Patch

Index: gcc/reg-notes.def
===================================================================
--- gcc/reg-notes.def	2014-05-17 13:44:06.056606500 +0100
+++ gcc/reg-notes.def	2014-05-17 17:13:37.685638401 +0100
@@ -188,11 +188,6 @@  REG_NOTE (NORETURN)
    computed goto.  */
 REG_NOTE (NON_LOCAL_GOTO)
 
-/* Indicates that a jump crosses between hot and cold sections in a
-   (partitioned) assembly or .o file, and therefore should not be
-   reduced to a simpler jump by optimizations.  */
-REG_NOTE (CROSSING_JUMP)
-
 /* This kind of note is generated at each to `setjmp', and similar
    functions that can return twice.  */
 REG_NOTE (SETJMP)
Index: gcc/rtl.h
===================================================================
--- gcc/rtl.h	2014-05-17 13:44:06.056606500 +0100
+++ gcc/rtl.h	2014-05-17 17:13:37.686638410 +0100
@@ -276,6 +276,7 @@  struct GTY((chain_next ("RTX_NEXT (&%h)"
 
   /* 1 in a MEM if we should keep the alias set for this mem unchanged
      when we access a component.
+     1 in a JUMP_INSN if it is a crossing jump.
      1 in a CALL_INSN if it is a sibling call.
      1 in a SET that is for a return.
      In a CODE_LABEL, part of the two-bit alternate entry field.
@@ -942,6 +943,10 @@  #define RTX_FRAME_RELATED_P(RTX)					\
 #define INSN_DELETED_P(RTX)						\
   (RTL_INSN_CHAIN_FLAG_CHECK ("INSN_DELETED_P", (RTX))->volatil)
 
+/* 1 if JUMP RTX is a crossing jump.  */
+#define CROSSING_JUMP_P(RTX) \
+  (RTL_FLAG_CHECK1 ("CROSSING_JUMP_P", (RTX), JUMP_INSN)->jump)
+
 /* 1 if RTX is a call to a const function.  Built from ECF_CONST and
    TREE_READONLY.  */
 #define RTL_CONST_CALL_P(RTX)					\
Index: gcc/cfgcleanup.c
===================================================================
--- gcc/cfgcleanup.c	2014-05-17 13:44:06.056606500 +0100
+++ gcc/cfgcleanup.c	2014-05-17 17:13:37.677638330 +0100
@@ -419,7 +419,7 @@  try_forward_edges (int mode, basic_block
      partition boundaries).  See the comments at the top of
      bb-reorder.c:partition_hot_cold_basic_blocks for complete details.  */
 
-  if (find_reg_note (BB_END (b), REG_CROSSING_JUMP, NULL_RTX))
+  if (JUMP_P (BB_END (b)) && CROSSING_JUMP_P (BB_END (b)))
     return false;
 
   for (ei = ei_start (b->succs); (e = ei_safe_edge (ei)); )
@@ -457,7 +457,8 @@  try_forward_edges (int mode, basic_block
 	 details.  */
 
       if (first != EXIT_BLOCK_PTR_FOR_FN (cfun)
-	  && find_reg_note (BB_END (first), REG_CROSSING_JUMP, NULL_RTX))
+	  && JUMP_P (BB_END (first))
+	  && CROSSING_JUMP_P (BB_END (first)))
 	return changed;
 
       while (counter < n_basic_blocks_for_fn (cfun))
@@ -2797,7 +2798,7 @@  try_optimize_cfg (int mode)
 	      if (single_succ_p (b)
 		  && single_succ (b) != EXIT_BLOCK_PTR_FOR_FN (cfun)
 		  && onlyjump_p (BB_END (b))
-		  && !find_reg_note (BB_END (b), REG_CROSSING_JUMP, NULL_RTX)
+		  && !CROSSING_JUMP_P (BB_END (b))
 		  && try_redirect_by_replacing_jump (single_succ_edge (b),
 						     single_succ (b),
 						     (mode & CLEANUP_CFGLAYOUT) != 0))
Index: gcc/cfghooks.c
===================================================================
--- gcc/cfghooks.c	2014-05-17 13:44:06.056606500 +0100
+++ gcc/cfghooks.c	2014-05-17 17:13:37.677638330 +0100
@@ -965,7 +965,7 @@  tidy_fallthru_edges (void)
 	  s = single_succ_edge (b);
 	  if (! (s->flags & EDGE_COMPLEX)
 	      && s->dest == c
-	      && !find_reg_note (BB_END (b), REG_CROSSING_JUMP, NULL_RTX))
+	      && !(JUMP_P (BB_END (b)) && CROSSING_JUMP_P (BB_END (b))))
 	    tidy_fallthru_edge (s);
 	}
     }
Index: gcc/cfgrtl.c
===================================================================
--- gcc/cfgrtl.c	2014-05-17 13:44:06.056606500 +0100
+++ gcc/cfgrtl.c	2014-05-17 17:13:37.678638339 +0100
@@ -1325,8 +1325,6 @@  redirect_branch_edge (edge e, basic_bloc
 static void
 fixup_partition_crossing (edge e)
 {
-  rtx note;
-
   if (e->src == ENTRY_BLOCK_PTR_FOR_FN (cfun) || e->dest
       == EXIT_BLOCK_PTR_FOR_FN (cfun))
     return;
@@ -1337,10 +1335,9 @@  fixup_partition_crossing (edge e)
   if (BB_PARTITION (e->src) != BB_PARTITION (e->dest))
     {
       e->flags |= EDGE_CROSSING;
-      note = find_reg_note (BB_END (e->src), REG_CROSSING_JUMP, NULL_RTX);
       if (JUMP_P (BB_END (e->src))
-          && !note)
-        add_reg_note (BB_END (e->src), REG_CROSSING_JUMP, NULL_RTX);
+	  && !CROSSING_JUMP_P (BB_END (e->src)))
+	CROSSING_JUMP_P (BB_END (e->src)) = 1;
     }
   else if (BB_PARTITION (e->src) == BB_PARTITION (e->dest))
     {
@@ -1348,8 +1345,7 @@  fixup_partition_crossing (edge e)
       /* Remove the section crossing note from jump at end of
          src if it exists, and if no other successors are
          still crossing.  */
-      note = find_reg_note (BB_END (e->src), REG_CROSSING_JUMP, NULL_RTX);
-      if (note)
+      if (JUMP_P (BB_END (e->src)) && CROSSING_JUMP_P (BB_END (e->src)))
         {
           bool has_crossing_succ = false;
           edge e2;
@@ -1361,7 +1357,7 @@  fixup_partition_crossing (edge e)
                 break;
             }
           if (!has_crossing_succ)
-            remove_note (BB_END (e->src), note);
+	    CROSSING_JUMP_P (BB_END (e->src)) = 0;
         }
     }
 }
@@ -2460,8 +2456,7 @@  rtl_verify_edges (void)
 			 e->src->index);
 		  err = 1;
 		}
-              if (JUMP_P (BB_END (bb))
-                  && !find_reg_note (BB_END (bb), REG_CROSSING_JUMP, NULL_RTX))
+              if (JUMP_P (BB_END (bb)) && !CROSSING_JUMP_P (BB_END (bb)))
 		{
 		  error ("No region crossing jump at section boundary in bb %i",
 			 bb->index);
@@ -2496,7 +2491,8 @@  rtl_verify_edges (void)
 	}
 
         if (!has_crossing_edge
-            && find_reg_note (BB_END (bb), REG_CROSSING_JUMP, NULL_RTX))
+	    && JUMP_P (BB_END (bb))
+	    && CROSSING_JUMP_P (BB_END (bb)))
           {
             print_rtl_with_bb (stderr, get_insns (), TDF_RTL | TDF_BLOCKS | TDF_DETAILS);
             error ("Region crossing jump across same section in bb %i",
Index: gcc/emit-rtl.c
===================================================================
--- gcc/emit-rtl.c	2014-05-17 13:44:06.056606500 +0100
+++ gcc/emit-rtl.c	2014-05-17 17:13:37.683638383 +0100
@@ -3590,11 +3590,13 @@  try_split (rtx pat, rtx trial, int last)
      may have introduced invalid RTL sharing, so unshare the sequence now.  */
   unshare_all_rtl_in_chain (seq);
 
-  /* Mark labels.  */
+  /* Mark labels and copy flags.  */
   for (insn = insn_last; insn ; insn = PREV_INSN (insn))
     {
       if (JUMP_P (insn))
 	{
+	  if (JUMP_P (trial))
+	    CROSSING_JUMP_P (insn) = CROSSING_JUMP_P (trial);
 	  mark_jump_label (PATTERN (insn), insn, 0);
 	  njumps++;
 	  if (probability != -1
@@ -3671,7 +3673,6 @@  try_split (rtx pat, rtx trial, int last)
 	  break;
 
 	case REG_NON_LOCAL_GOTO:
-	case REG_CROSSING_JUMP:
 	  for (insn = insn_last; insn != NULL_RTX; insn = PREV_INSN (insn))
 	    {
 	      if (JUMP_P (insn))
Index: gcc/haifa-sched.c
===================================================================
--- gcc/haifa-sched.c	2014-05-17 13:44:06.056606500 +0100
+++ gcc/haifa-sched.c	2014-05-17 17:13:37.684638392 +0100
@@ -7653,7 +7653,7 @@  sched_create_recovery_edges (basic_block
 	{
 	  /* We don't need the same note for the check because
 	     any_condjump_p (check) == true.  */
-	  add_reg_note (jump, REG_CROSSING_JUMP, NULL_RTX);
+	  CROSSING_JUMP_P (jump) = 1;
 	}
       edge_flags = EDGE_CROSSING;
     }
Index: gcc/ifcvt.c
===================================================================
--- gcc/ifcvt.c	2014-05-17 13:44:06.056606500 +0100
+++ gcc/ifcvt.c	2014-05-17 17:13:37.684638392 +0100
@@ -3877,12 +3877,14 @@  find_if_case_1 (basic_block test_bb, edg
      bb-reorder.c:partition_hot_cold_basic_blocks for complete details.  */
 
   if ((BB_END (then_bb)
-       && find_reg_note (BB_END (then_bb), REG_CROSSING_JUMP, NULL_RTX))
+       && JUMP_P (BB_END (then_bb))
+       && CROSSING_JUMP_P (BB_END (then_bb)))
       || (BB_END (test_bb)
-	  && find_reg_note (BB_END (test_bb), REG_CROSSING_JUMP, NULL_RTX))
+	  && JUMP_P (BB_END (test_bb))
+	  && CROSSING_JUMP_P (BB_END (test_bb)))
       || (BB_END (else_bb)
-	  && find_reg_note (BB_END (else_bb), REG_CROSSING_JUMP,
-			    NULL_RTX)))
+	  && JUMP_P (BB_END (else_bb))
+	  && CROSSING_JUMP_P (BB_END (else_bb))))
     return FALSE;
 
   /* THEN has one successor.  */
@@ -4000,12 +4002,14 @@  find_if_case_2 (basic_block test_bb, edg
      bb-reorder.c:partition_hot_cold_basic_blocks for complete details.  */
 
   if ((BB_END (then_bb)
-       && find_reg_note (BB_END (then_bb), REG_CROSSING_JUMP, NULL_RTX))
+       && JUMP_P (BB_END (then_bb))
+       && CROSSING_JUMP_P (BB_END (then_bb)))
       || (BB_END (test_bb)
-	  && find_reg_note (BB_END (test_bb), REG_CROSSING_JUMP, NULL_RTX))
+	  && JUMP_P (BB_END (test_bb))
+	  && CROSSING_JUMP_P (BB_END (test_bb)))
       || (BB_END (else_bb)
-	  && find_reg_note (BB_END (else_bb), REG_CROSSING_JUMP,
-			    NULL_RTX)))
+	  && JUMP_P (BB_END (else_bb))
+	  && CROSSING_JUMP_P (BB_END (else_bb))))
     return FALSE;
 
   /* ELSE has one successor.  */
Index: gcc/jump.c
===================================================================
--- gcc/jump.c	2014-05-17 13:44:06.056606500 +0100
+++ gcc/jump.c	2014-05-17 17:13:37.685638401 +0100
@@ -1590,11 +1590,7 @@  redirect_jump_2 (rtx jump, rtx olabel, r
      label and are now changing it into a direct conditional return.
      The jump is no longer crossing in that case.  */
   if (ANY_RETURN_P (nlabel))
-    {
-      note = find_reg_note (jump, REG_CROSSING_JUMP, NULL_RTX);
-      if (note)
-	remove_note (jump, note);
-    }
+    CROSSING_JUMP_P (jump) = 0;
 
   if (!ANY_RETURN_P (olabel)
       && --LABEL_NUSES (olabel) == 0 && delete_unused > 0
Index: gcc/reorg.c
===================================================================
--- gcc/reorg.c	2014-05-17 13:44:06.056606500 +0100
+++ gcc/reorg.c	2014-05-17 17:13:37.685638401 +0100
@@ -2289,8 +2289,8 @@  fill_simple_delay_slots (int non_jumps_p
    If LABEL is not followed by a jump, return LABEL.
    If the chain loops or we can't find end, return LABEL,
    since that tells caller to avoid changing the insn.
-   If the returned label is obtained by following a REG_CROSSING_JUMP
-   jump, set *CROSSING to true, otherwise set it to false.  */
+   If the returned label is obtained by following a crossing jump,
+   set *CROSSING to true, otherwise set it to false.  */
 
 static rtx
 follow_jumps (rtx label, rtx jump, bool *crossing)
@@ -2330,8 +2330,7 @@  follow_jumps (rtx label, rtx jump, bool
       if (!targetm.can_follow_jump (jump, insn))
 	break;
       if (!*crossing)
-	*crossing
-	  = find_reg_note (insn, REG_CROSSING_JUMP, NULL_RTX) != NULL_RTX;
+	*crossing = CROSSING_JUMP_P (jump);
       value = this_label;
     }
   if (depth == 10)
@@ -2800,7 +2799,7 @@  fill_slots_from_thread (rtx insn, rtx co
 	{
 	  reorg_redirect_jump (insn, label);
 	  if (crossing)
-	    set_unique_reg_note (insn, REG_CROSSING_JUMP, NULL_RTX);
+	    CROSSING_JUMP_P (insn) = 1;
 	}
     }
 
@@ -3175,7 +3174,7 @@  relax_delay_slots (rtx first)
 	    {
 	      reorg_redirect_jump (insn, target_label);
 	      if (crossing)
-		set_unique_reg_note (insn, REG_CROSSING_JUMP, NULL_RTX);
+		CROSSING_JUMP_P (insn) = 1;
 	    }
 
 	  /* See if this jump conditionally branches around an unconditional
@@ -3320,7 +3319,7 @@  relax_delay_slots (rtx first)
 	  reorg_redirect_jump (delay_insn, trial);
 	  target_label = trial;
 	  if (crossing)
-	    set_unique_reg_note (insn, REG_CROSSING_JUMP, NULL_RTX);
+	    CROSSING_JUMP_P (insn) = 1;
 	}
 
       /* If the first insn at TARGET_LABEL is redundant with a previous
Index: gcc/config/arc/arc.md
===================================================================
--- gcc/config/arc/arc.md	2014-05-17 13:44:06.056606500 +0100
+++ gcc/config/arc/arc.md	2014-05-17 17:13:37.680638357 +0100
@@ -3480,7 +3480,7 @@  (define_expand "jump"
 
 (define_insn "jump_i"
   [(set (pc) (label_ref (match_operand 0 "" "")))]
-  "!TARGET_LONG_CALLS_SET || !find_reg_note (insn, REG_CROSSING_JUMP, NULL_RTX)"
+  "!TARGET_LONG_CALLS_SET || !CROSSING_JUMP_P (insn)"
   "b%!%* %^%l0%&"
   [(set_attr "type" "uncond_branch")
    (set (attr "iscompact")
@@ -3496,7 +3496,7 @@  (define_insn "jump_i"
 	  (eq_attr "delay_slot_filled" "yes")
 	  (const_int 4)
 
-	  (match_test "find_reg_note (insn, REG_CROSSING_JUMP, NULL_RTX)")
+	  (match_test "CROSSING_JUMP_P (insn)")
 	  (const_int 4)
 
 	  (ior (lt (minus (match_dup 0) (pc)) (const_int -512))
@@ -4589,7 +4589,7 @@  (define_insn "cbranchsi4_scratch"
    "(reload_completed
      || (TARGET_EARLY_CBRANCHSI
 	 && brcc_nolimm_operator (operands[0], VOIDmode)))
-    && !find_reg_note (insn, REG_CROSSING_JUMP, NULL_RTX)"
+    && !CROSSING_JUMP_P (insn)"
    "*
      switch (get_attr_length (insn))
      {
@@ -4653,7 +4653,7 @@  (define_insn "*bbit"
 	  (label_ref (match_operand 0 "" ""))
 	  (pc)))
    (clobber (reg:CC_ZN CC_REG))]
-  "!find_reg_note (insn, REG_CROSSING_JUMP, NULL_RTX)"
+  "!CROSSING_JUMP_P (insn)"
 {
   switch (get_attr_length (insn))
     {
@@ -4693,7 +4693,7 @@  (define_insn_and_split "*bbit_di"
 	  (label_ref (match_operand 0 "" ""))
 	  (pc)))
    (clobber (reg:CC_ZN CC_REG))]
-  "!find_reg_note (insn, REG_CROSSING_JUMP, NULL_RTX)"
+  "!CROSSING_JUMP_P (insn)"
   "#"
   ""
   [(parallel
Index: gcc/config/arc/arc.c
===================================================================
--- gcc/config/arc/arc.c	2014-05-17 13:44:06.056606500 +0100
+++ gcc/config/arc/arc.c	2014-05-17 17:13:37.679638348 +0100
@@ -6051,7 +6051,7 @@  arc_reorg (void)
 	    continue;
 
 	  /* Now check if the jump is beyond the s9 range.  */
-	  if (find_reg_note (insn, REG_CROSSING_JUMP, NULL_RTX))
+	  if (CROSSING_JUMP_P (insn))
 	    continue;
 	  offset = branch_dest (insn) - INSN_ADDRESSES (INSN_UID (insn));
 
@@ -9206,7 +9206,7 @@  arc_decl_pretend_args (tree decl)
 
 /* Without this, gcc.dg/tree-prof/bb-reorg.c fails to assemble
   when compiling with -O2 -freorder-blocks-and-partition -fprofile-use
-  -D_PROFILE_USE; delay branch scheduling then follows a REG_CROSSING_JUMP
+  -D_PROFILE_USE; delay branch scheduling then follows a crossing jump
   to redirect two breqs.  */
 
 static bool
@@ -9216,7 +9216,7 @@  arc_can_follow_jump (const_rtx follower,
   union { const_rtx c; rtx r; } u;
 
   u.c = follower;
-  if (find_reg_note (followee, REG_CROSSING_JUMP, NULL_RTX))
+  if (CROSSING_JUMP_P (followee))
     switch (get_attr_type (u.r))
       {
       case TYPE_BRCC:
Index: gcc/config/sh/sh.md
===================================================================
--- gcc/config/sh/sh.md	2014-05-17 13:44:06.056606500 +0100
+++ gcc/config/sh/sh.md	2014-05-17 17:13:37.682638375 +0100
@@ -8804,7 +8804,7 @@  (define_insn_and_split "doloop_end_split
 (define_insn "jump_compact"
   [(set (pc)
 	(label_ref (match_operand 0 "" "")))]
-  "TARGET_SH1 && !find_reg_note (insn, REG_CROSSING_JUMP, NULL_RTX)"
+  "TARGET_SH1 && !CROSSING_JUMP_P (insn)"
 {
   /* The length is 16 if the delay slot is unfilled.  */
   if (get_attr_length(insn) > 4)
Index: gcc/bb-reorder.c
===================================================================
--- gcc/bb-reorder.c	2014-05-17 13:44:06.056606500 +0100
+++ gcc/bb-reorder.c	2014-05-17 17:16:46.445311219 +0100
@@ -425,8 +425,7 @@  rotate_loop (edge back_edge, struct trac
 	      /* Duplicate HEADER if it is a small block containing cond jump
 		 in the end.  */
 	      if (any_condjump_p (BB_END (header)) && copy_bb_p (header, 0)
-		  && !find_reg_note (BB_END (header), REG_CROSSING_JUMP,
-				     NULL_RTX))
+		  && !CROSSING_JUMP_P (BB_END (header)))
 		copy_bb (header, single_succ_edge (prev_bb), prev_bb, trace_n);
 	    }
 	}
@@ -2194,10 +2193,10 @@  fix_crossing_unconditional_branches (voi
     }
 }
 
-/* Add REG_CROSSING_JUMP note to all crossing jump insns.  */
+/* Update CROSSING_JUMP_P flags on all jump insns.  */
 
 static void
-add_reg_crossing_jump_notes (void)
+update_crossing_jump_flags (void)
 {
   basic_block bb;
   edge e;
@@ -2205,12 +2204,15 @@  add_reg_crossing_jump_notes (void)
 
   FOR_EACH_BB_FN (bb, cfun)
     FOR_EACH_EDGE (e, ei, bb->succs)
-      if ((e->flags & EDGE_CROSSING)
-	  && JUMP_P (BB_END (e->src))
-          /* Some notes were added during fix_up_fall_thru_edges, via
-             force_nonfallthru_and_redirect.  */
-          && !find_reg_note (BB_END (e->src), REG_CROSSING_JUMP, NULL_RTX))
-	add_reg_note (BB_END (e->src), REG_CROSSING_JUMP, NULL_RTX);
+      if (e->flags & EDGE_CROSSING)
+	{
+	  if (JUMP_P (BB_END (bb))
+	      /* Some flags were added during fix_up_fall_thru_edges, via
+		 force_nonfallthru_and_redirect.  */
+	      && !CROSSING_JUMP_P (BB_END (bb)))
+	    CROSSING_JUMP_P (BB_END (bb)) = 1;
+	  break;
+	}
 }
 
 /* Reorder basic blocks.  The main entry point to this file.  FLAGS is
@@ -2454,7 +2456,7 @@  pass_duplicate_computed_gotos::execute (
 	continue;
 
       /* Only consider blocks that can be duplicated.  */
-      if (find_reg_note (BB_END (bb), REG_CROSSING_JUMP, NULL_RTX)
+      if (CROSSING_JUMP_P (BB_END (bb))
 	  || !can_duplicate_block_p (bb))
 	continue;
 
@@ -2507,7 +2509,7 @@  pass_duplicate_computed_gotos::execute (
 
       /* Don't duplicate a partition crossing edge, which requires difficult
          fixup.  */
-      if (find_reg_note (BB_END (bb), REG_CROSSING_JUMP, NULL_RTX))
+      if (JUMP_P (BB_END (bb)) && CROSSING_JUMP_P (BB_END (bb)))
 	continue;
 
       new_bb = duplicate_block (single_succ (bb), single_succ_edge (bb), bb);
@@ -2710,7 +2712,7 @@  pass_partition_blocks::execute (function
   if (!HAS_LONG_UNCOND_BRANCH)
     fix_crossing_unconditional_branches ();
 
-  add_reg_crossing_jump_notes ();
+  update_crossing_jump_flags ();
 
   /* Clear bb->aux fields that the above routines were using.  */
   clear_aux_for_blocks ();