[GOOGLE] Remove mod_id_to_name map

2014-01-08 Thread Dehao Chen
This patch removes mod_id_to_name map because the info is already
there in module_infos. And also, AutoFDO don't have access to update
this map because its a file-static structure.

Bootstrapped and passed regression test.

OK for google branch?

Thanks,
Dehao

Index: gcc/coverage.c
===
--- gcc/coverage.c (revision 206366)
+++ gcc/coverage.c (working copy)
@@ -615,37 +615,17 @@ reorder_module_groups (const char *imports_file, u
   module_name_tab.dispose ();
 }

-typedef struct {
-  unsigned int mod_id;
-  const char *mod_name;
-} mod_id_to_name_t;
-
-static vecmod_id_to_name_t *mod_names;
-
-static void
-record_module_name (unsigned int mod_id, const char *name)
-{
-  mod_id_to_name_t t;
-
-  t.mod_id = mod_id;
-  t.mod_name = xstrdup (name);
-  if (!mod_names)
-vec_alloc (mod_names, 10);
-  mod_names-safe_push (t);
-}
-
 /* Return the module name for module with MOD_ID.  */

 const char *
 get_module_name (unsigned int mod_id)
 {
   size_t i;
-  mod_id_to_name_t *elt;

-  for (i = 0; mod_names-iterate (i, elt); i++)
+  for (i = 0; i  num_in_fnames; i++)
 {
-  if (elt-mod_id == mod_id)
-return elt-mod_name;
+  if (module_infos[i]-ident == mod_id)
+return lbasename (module_infos[i]-source_filename);
 }

   gcc_assert (0);
@@ -927,9 +907,6 @@ read_counts_file (const char *da_file_name, unsign
  }
 }

-  record_module_name (mod_info-ident,
-  lbasename (mod_info-source_filename));
-
   if (dump_enabled_p ())
 {
   dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, input_location,


Re: [GOOGLE] Remove mod_id_to_name map

2014-01-08 Thread Xinliang David Li
Ok.

David

On Wed, Jan 8, 2014 at 10:58 AM, Dehao Chen de...@google.com wrote:
 This patch removes mod_id_to_name map because the info is already
 there in module_infos. And also, AutoFDO don't have access to update
 this map because its a file-static structure.

 Bootstrapped and passed regression test.

 OK for google branch?

 Thanks,
 Dehao

 Index: gcc/coverage.c
 ===
 --- gcc/coverage.c (revision 206366)
 +++ gcc/coverage.c (working copy)
 @@ -615,37 +615,17 @@ reorder_module_groups (const char *imports_file, u
module_name_tab.dispose ();
  }

 -typedef struct {
 -  unsigned int mod_id;
 -  const char *mod_name;
 -} mod_id_to_name_t;
 -
 -static vecmod_id_to_name_t *mod_names;
 -
 -static void
 -record_module_name (unsigned int mod_id, const char *name)
 -{
 -  mod_id_to_name_t t;
 -
 -  t.mod_id = mod_id;
 -  t.mod_name = xstrdup (name);
 -  if (!mod_names)
 -vec_alloc (mod_names, 10);
 -  mod_names-safe_push (t);
 -}
 -
  /* Return the module name for module with MOD_ID.  */

  const char *
  get_module_name (unsigned int mod_id)
  {
size_t i;
 -  mod_id_to_name_t *elt;

 -  for (i = 0; mod_names-iterate (i, elt); i++)
 +  for (i = 0; i  num_in_fnames; i++)
  {
 -  if (elt-mod_id == mod_id)
 -return elt-mod_name;
 +  if (module_infos[i]-ident == mod_id)
 +return lbasename (module_infos[i]-source_filename);
  }

gcc_assert (0);
 @@ -927,9 +907,6 @@ read_counts_file (const char *da_file_name, unsign
   }
  }

 -  record_module_name (mod_info-ident,
 -  lbasename (mod_info-source_filename));
 -
if (dump_enabled_p ())
  {
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, input_location,