diff gcc/cgraphbuild.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
line wrap: on
line diff
--- a/gcc/cgraphbuild.c	Fri Oct 27 22:46:09 2017 +0900
+++ b/gcc/cgraphbuild.c	Thu Oct 25 07:37:49 2018 +0900
@@ -1,5 +1,5 @@
 /* Callgraph construction.
-   Copyright (C) 2003-2017 Free Software Foundation, Inc.
+   Copyright (C) 2003-2018 Free Software Foundation, Inc.
    Contributed by Jan Hubicka
 
 This file is part of GCC.
@@ -190,21 +190,8 @@
 int
 compute_call_stmt_bb_frequency (tree decl, basic_block bb)
 {
-  int entry_freq = ENTRY_BLOCK_PTR_FOR_FN
-  		     (DECL_STRUCT_FUNCTION (decl))->frequency;
-  int freq = bb->frequency;
-
-  if (profile_status_for_fn (DECL_STRUCT_FUNCTION (decl)) == PROFILE_ABSENT)
-    return CGRAPH_FREQ_BASE;
-
-  if (!entry_freq)
-    entry_freq = 1, freq++;
-
-  freq = freq * CGRAPH_FREQ_BASE / entry_freq;
-  if (freq > CGRAPH_FREQ_MAX)
-    freq = CGRAPH_FREQ_MAX;
-
-  return freq;
+  return bb->count.to_cgraph_frequency
+      (ENTRY_BLOCK_PTR_FOR_FN (DECL_STRUCT_FUNCTION (decl))->count);
 }
 
 /* Mark address taken in STMT.  */
@@ -330,17 +317,15 @@
 
 	  if (gcall *call_stmt = dyn_cast <gcall *> (stmt))
 	    {
-	      int freq = compute_call_stmt_bb_frequency (current_function_decl,
-							 bb);
 	      decl = gimple_call_fndecl (call_stmt);
 	      if (decl)
-		node->create_edge (cgraph_node::get_create (decl), call_stmt, bb->count, freq);
+		node->create_edge (cgraph_node::get_create (decl), call_stmt, bb->count);
 	      else if (gimple_call_internal_p (call_stmt))
 		;
 	      else
 		node->create_indirect_edge (call_stmt,
 					    gimple_call_flags (call_stmt),
-					    bb->count, freq);
+					    bb->count);
 	    }
 	  node->record_stmt_references (stmt);
 	  if (gomp_parallel *omp_par_stmt = dyn_cast <gomp_parallel *> (stmt))
@@ -426,18 +411,16 @@
 
 	  if (gcall *call_stmt = dyn_cast <gcall *> (stmt))
 	    {
-	      int freq = compute_call_stmt_bb_frequency (current_function_decl,
-							 bb);
 	      decl = gimple_call_fndecl (call_stmt);
 	      if (decl)
 		node->create_edge (cgraph_node::get_create (decl), call_stmt,
-				   bb->count, freq);
+				   bb->count);
 	      else if (gimple_call_internal_p (call_stmt))
 		;
 	      else
 		node->create_indirect_edge (call_stmt,
 					    gimple_call_flags (call_stmt),
-					    bb->count, freq);
+					    bb->count);
 	    }
 	  node->record_stmt_references (stmt);
 	}
@@ -446,11 +429,6 @@
     }
   record_eh_tables (node, cfun);
   gcc_assert (!node->global.inlined_to);
-
-  if (node->instrumented_version
-      && !node->instrumentation_clone)
-    node->create_reference (node->instrumented_version, IPA_REF_CHKP, NULL);
-
   return 0;
 }
 
@@ -481,10 +459,6 @@
 	node->record_stmt_references (gsi_stmt (gsi));
     }
   record_eh_tables (node, cfun);
-
-  if (node->instrumented_version
-      && !node->instrumentation_clone)
-    node->create_reference (node->instrumented_version, IPA_REF_CHKP, NULL);
 }
 
 namespace {