re PR fortran/57992 (Pointless packing of contiguous arrays for simply contiguous...
[gcc.git] / gcc / cgraphbuild.c
index d853acd883d20581527e893214eee3d7f750599e..97c010531bb0c360aae6d1c6e5b4daa285722f76 100644 (file)
@@ -1,5 +1,5 @@
 /* Callgraph construction.
-   Copyright (C) 2003-2017 Free Software Foundation, Inc.
+   Copyright (C) 2003-2019 Free Software Foundation, Inc.
    Contributed by Jan Hubicka
 
 This file is part of GCC.
@@ -190,21 +190,8 @@ record_eh_tables (cgraph_node *node, function *fun)
 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 @@ pass_build_cgraph_edges::execute (function *fun)
 
          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 @@ cgraph_edge::rebuild_edges (void)
 
          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 @@ cgraph_edge::rebuild_edges (void)
     }
   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 @@ cgraph_edge::rebuild_references (void)
        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 {