[BOLT] Fix aggregator w.r.t. split functions

Summary:
We should not rely on split function detection while aggregating
data, but only look up the original function names in the symbol table.
Split function detection should be done by BOLT and not perf2bolt while
writing the profile. Then, BOLT, when reading it, will take care of
combining functions if necessary.

This caused a bug in bolted data collection where samples in cold parts
of a function were being falsely attributed to the hot part of a function
instead of being attributed to the cold part, causing incorrect translation of
addresses.

(cherry picked from FBD16993065)
This commit is contained in:
Rafael Auler 2019-08-23 12:18:31 -07:00 committed by Maksim Panchenko
parent f588d7a6ea
commit 243507db99
1 changed files with 7 additions and 1 deletions

View File

@ -597,8 +597,14 @@ DataAggregator::getBinaryFunctionContainingAddress(uint64_t Address) const {
if (!BC->containsAddress(Address))
return nullptr;
// Use shallow search to avoid fetching the parent function, in case
// BinaryContext linked two functions. When aggregating data and writing the
// profile, we want to write offsets relative to the closest symbol in the
// symbol table, not relative to the parent function, to avoid creating
// profile that is too fragile and depends on the layout of other functions.
return BC->getBinaryFunctionContainingAddress(Address, /*CheckPastEnd=*/false,
/*UseMaxSize=*/true);
/*UseMaxSize=*/true,
/*Shallow=*/true);
}
StringRef DataAggregator::getLocationName(BinaryFunction &Func,