predict.c (counts_to_freqs): Make glolbal.
authorJan Hubicka <jh@suse.cz>
Sat, 25 Sep 2004 10:06:18 +0000 (12:06 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sat, 25 Sep 2004 10:06:18 +0000 (10:06 +0000)
* predict.c (counts_to_freqs): Make glolbal.
* predict.h (counts_to_freqa): Declare.
* profile.c (compute_branch_probabilities): Compute frequencies
* tree-profile.c (do_tree_profiling): Refine conditional on when
tree profiling pass is needed.

From-SVN: r88093

gcc/ChangeLog
gcc/predict.c
gcc/predict.h
gcc/profile.c
gcc/tree-profile.c

index db7034463da2b9c7b5aa53adf883a4065c88b762..023b449ed37008408bb99f703398f69ffc9c8322 100644 (file)
@@ -1,5 +1,11 @@
 2004-09-25  Jan Hubicka  <jh@suse.cz>
 
+       * predict.c (counts_to_freqs): Make glolbal.
+       * predict.h (counts_to_freqa): Declare.
+       * profile.c (compute_branch_probabilities): Compute frequencies
+       * tree-profile.c (do_tree_profiling): Refine conditional on when
+       tree profiling pass is needed.
+
        * passes.c (rest_of_handle_cfg): Disable const/pure function
        detection when doing tree based profiling.
 
index cc314ecad742cb244d8f9ea6e739ef3f16184934..18b6b90814cd8c219cdcf9e816738d39a0ad499b 100644 (file)
@@ -76,7 +76,6 @@ static void dump_prediction (FILE *, enum br_predictor, int, basic_block, int);
 static void estimate_loops_at_level (struct loop *loop);
 static void propagate_freq (struct loop *);
 static void estimate_bb_frequencies (struct loops *);
-static int counts_to_freqs (void);
 static void predict_paths_leading_to (basic_block, int *, enum br_predictor, enum prediction);
 static bool last_basic_block_p (basic_block);
 static void compute_function_frequency (void);
@@ -1705,7 +1704,7 @@ estimate_loops_at_level (struct loop *first_loop)
 /* Convert counts measured by profile driven feedback to frequencies.
    Return nonzero iff there was any nonzero execution count.  */
 
-static int
+int
 counts_to_freqs (void)
 {
   gcov_type count_max, true_count_max = 0;
index 16817f9b5b643e820432f223dc2af2a585eb7027..77198118f08507866ac5e84ca62d58adada6627b 100644 (file)
@@ -41,5 +41,6 @@ enum prediction
 
 extern void predict_insn_def (rtx, enum br_predictor, enum prediction);
 extern void predict_insn (rtx, enum br_predictor, int);
+extern int counts_to_freqs (void);
 
 #endif  /* GCC_PREDICT_H */
index 7b04bfdf12f9010ba41ffc2195897bf35ffee1a0..3f48be623d2d494bac5b600dd414facdf5d79797 100644 (file)
@@ -590,6 +590,7 @@ compute_branch_probabilities (void)
            num_branches++, num_never_executed;
        }
     }
+  counts_to_freqs ();
 
   if (dump_file)
     {
index 29299e53ccacf03bd78d7453470dcb523590b3b2..00c36e233ec52a1c051202fc8c8ac9e4d9f669e7 100644 (file)
@@ -160,12 +160,14 @@ tree_gen_const_delta_profiler (histogram_value value ATTRIBUTE_UNUSED,
 
 static bool do_tree_profiling (void)
 {
-  if (flag_tree_based_profiling)
+  if (flag_tree_based_profiling
+      && (profile_arc_flag || flag_test_coverage || flag_branch_probabilities))
     {
       tree_register_profile_hooks ();
       tree_register_value_prof_hooks ();
+      return true;
     }
-  return flag_tree_based_profiling;
+  return false;
 }
 
 /* Return the file on which profile dump output goes, if any.  */