> gcc/ChangeLog: > * auto-profile.cc (AUTO_PROFILE_VERSION): Bump from 2 to 3. > (string_table::get_real_name): Define new member function. > (string_table::get_file_name): Likewise. > (string_table::get_file_name_idx): Likewise. > (string_table::real_names_): Define new class member. > (string_table::file_names_): Likewise. > (string_table::file_map_): Likewise. > (string_table::name_instance_map): Update to be a 2-dimensional > map from function name to file name to function_instance *. > (string_table::~string_table): Deallocate from real_names_ and > file_names_ as well. > (string_table::read): Read file name header from GCOV file. > (autofdo_source_profile::~autofdo_source_profile): Deallocate > from nested map. > (autofdo_source_profile::read): Use file name when storing entry > into map_. > (autofdo_source_profile::get_function_instance_by_decl): Use > DECL_SOURCE_FILE for function_instance lookup. > (autofdo_source_profile::get_function_instance_by_inline_stack): > Likewise.
> @@ -457,7 +471,12 @@ has_indirect_call (basic_block bb) > string_table::~string_table () > { > for (unsigned i = 0; i < vector_.length (); i++) > - free (vector_[i]); > + { > + free (vector_[i]); > + free (real_names_[i]); > + } > + for (unsigned i = 0; i < file_names_.length (); i++) > + free (file_names_[i]); I see those are auto_vec<char *> The choice between std::, gcc-spefic C++ containers and plain C data-structures in this file bit escapes me. But I guess we can handle this separately. > /* Read the string table. Return TRUE if reading is successful. */ I believe there is a comment describing the file format. Be sure to update it. > diff --git a/gcc/testsuite/lib/profopt.exp b/gcc/testsuite/lib/profopt.exp > index b4d244b3132..8f0d0c5c554 100644 > --- a/gcc/testsuite/lib/profopt.exp > +++ b/gcc/testsuite/lib/profopt.exp > @@ -451,7 +451,7 @@ proc profopt-execute { src } { > # convert profile > if { $run_autofdo == 1 } { > set bprefix "afdo." > - set cmd "create_gcov --binary $execname1 > --profile=$tmpdir/$base.perf.data -gcov_version=2 > --gcov=$tmpdir/$bprefix$base.$ext" > + set cmd "create_gcov --binary $execname1 > --profile=$tmpdir/$base.perf.data --gcov_version=3 > --gcov=$tmpdir/$bprefix$base.$ext" Is this change necessary? Does the create_gcov simply ignore -gcov-version=2 without error or something like that? Patch is OK, but please also post the create_gcov changes and wait with comitting so we can synchronize it with the lnt tester. I pushed the change to profile merging and it would be nice to have it benchmarked tonight. I will discuss with Petr patching create_gcov for version 3. Honza