jump.c (invert_jump): Always invert REG_BR_PROB.
authorRichard Henderson <rth@cygnus.com>
Thu, 27 Apr 2000 05:58:05 +0000 (22:58 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Thu, 27 Apr 2000 05:58:05 +0000 (22:58 -0700)
        * jump.c (invert_jump): Always invert REG_BR_PROB.  Do it correctly.

        * bb-reorder.c (reorder_basic_blocks): Don't run estimate_probability.
        * flow.c (calculate_loop_depth): Remove.
        * output.h (calculate_loop_depth): Don't declare.
        * toplev.c (rest_of_compilation): Expand calculate_loop_depth
        inline; run estimate_probability at the same time.

From-SVN: r33464

gcc/ChangeLog
gcc/bb-reorder.c
gcc/flow.c
gcc/jump.c
gcc/output.h
gcc/toplev.c

index 7931e3c..1d134c0 100644 (file)
@@ -1,3 +1,13 @@
+2000-04-26  Richard Henderson  <rth@cygnus.com>
+
+       * jump.c (invert_jump): Always invert REG_BR_PROB.  Do it correctly.
+
+       * bb-reorder.c (reorder_basic_blocks): Don't run estimate_probability.
+       * flow.c (calculate_loop_depth): Remove.
+       * output.h (calculate_loop_depth): Don't declare.
+       * toplev.c (rest_of_compilation): Expand calculate_loop_depth
+       inline; run estimate_probability at the same time.
+
 2000-04-26  Neil Booth  <NeilB@earthling.net>
 
        * cpplib.h: "~=" is not a single pp-token.
index 5f2e178..7812ff1 100644 (file)
@@ -813,10 +813,6 @@ reorder_basic_blocks ()
   /* Dump loop information.  */
   flow_loops_dump (&loops_info, rtl_dump_file, 0);
 
-  /* Estimate using heuristics if no profiling info is available.  */
-  if (! flag_branch_probabilities)
-    estimate_probability (&loops_info);
-
   reorder_last_visited = BASIC_BLOCK (0);
 
   for (i = 0; i < n_basic_blocks; i++)
index 7b24942..23402d3 100644 (file)
@@ -2469,23 +2469,6 @@ tidy_fallthru_edges ()
        tidy_fallthru_edge (s, b, c);
     }
 }
-
-/* Discover and record the loop depth at the head of each basic block.  */
-
-void
-calculate_loop_depth (dump)
-     FILE *dump;
-{
-  struct loops loops;
-
-  /* The loop infrastructure does the real job for us.  */
-  flow_loops_find (&loops);
-
-  if (dump)
-    flow_loops_dump (&loops, dump, 0);
-
-  flow_loops_free (&loops);
-}
 \f
 /* Perform data flow analysis.
    F is the first insn of the function; FLAGS is a set of PROP_* flags
index 6b5fecd..06b5bd5 100644 (file)
@@ -4431,17 +4431,13 @@ invert_jump (jump, nlabel)
 
   if (redirect_jump (jump, nlabel))
     {
-      if (flag_branch_probabilities)
-       {
-         rtx note = find_reg_note (jump, REG_BR_PROB, 0);
-
-         /* An inverted jump means that a probability taken becomes a
-            probability not taken.  Subtract the branch probability from the
-            probability base to convert it back to a taken probability.
-            (We don't flip the probability on a branch that's never taken.  */
-         if (note && XINT (XEXP (note, 0), 0) >= 0)
-           XINT (XEXP (note, 0), 0) = REG_BR_PROB_BASE - XINT (XEXP (note, 0), 0);
-       }
+      /* An inverted jump means that a probability taken becomes a
+        probability not taken.  Subtract the branch probability from the
+        probability base to convert it back to a taken probability.  */
+
+      rtx note = find_reg_note (jump, REG_BR_PROB, 0);
+      if (note)
+       XEXP (note, 0) = GEN_INT (REG_BR_PROB_BASE - INTVAL (XEXP (note, 0)));
 
       return 1;
     }
index e54bc35..6af8de6 100644 (file)
@@ -134,7 +134,6 @@ extern int regno_clobbered_at_setjmp        PARAMS ((int));
 extern void dump_flow_info             PARAMS ((FILE *));
 extern void find_basic_blocks          PARAMS ((rtx, int, FILE *));
 extern void cleanup_cfg                        PARAMS ((rtx));
-extern void calculate_loop_depth      PARAMS ((FILE *));
 extern void free_basic_block_vars     PARAMS ((int));
 extern void set_block_num             PARAMS ((rtx, int));
 #endif
index dd8ea2a..65f7ee8 100644 (file)
@@ -3246,7 +3246,22 @@ rest_of_compilation (decl)
        find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
        cleanup_cfg (insns);
        if (optimize)
-        calculate_loop_depth (rtl_dump_file);
+        {
+          struct loops loops;
+
+          /* Discover and record the loop depth at the head of each basic
+             block.  The loop infrastructure does the real job for us.  */
+          flow_loops_find (&loops);
+
+          /* Estimate using heuristics if no profiling info is available.  */
+          if (! flag_branch_probabilities)
+            estimate_probability (&loops);
+
+          if (rtl_dump_file)
+            flow_loops_dump (&loops, rtl_dump_file, 0);
+
+          flow_loops_free (&loops);
+        }
        life_analysis (insns, rtl_dump_file, PROP_FINAL);
        mark_constant_function ();
      });