DescriptionAdded better handling of outdated profiles.
gcc dumps profile information in .gcda files that contain the function id and
the corresponding counter information. The function cfg and line number
checksums are also stored along with the ids. When the program source changes
between when the instrumentation run is done vs. when the -fprofile-use is
passed, gcc will have functions that do not have a valid profile. These
functions could be hot and may not be inlined because the summary of the profile
is still valid (sum_max, etc.). This can lead to a situation where the
performance with -fprofile-use is lower than with -fno-profile-use.
It is easy to have a situation where the profile is outdated. A single line
change in the header file can potentially renumber all functions and none of the
ids will match the profile generated from the old source.
This patch makes the performance degradation in the outdated case much less
severe. It adds checks that the profile has been read for a certain function
before using the counter values (which are 0 in the case where the profile is
invalid).
Without this patch we see up to 15% performance degradation by using outdated
profiles vs. not using any profile information for Chrome. This patch decreases
that degradation down to (0% to 4%).
Patch Set 1 #
MessagesTotal messages: 5
|