[MemProf] Fix combined index handling for locals

Since the linker does not resolve local symbols, we cannot look up
whether they are prevailing. The prior check was blocking all locals
from getting memprof summaries in the combined index.

Modified the existing test case to contain a local. This necessitated
some other fixes as the order of summary entries changed.

Differential Revision: https://reviews.llvm.org/D140786
This commit is contained in:
Teresa Johnson
2022-12-30 07:47:12 -08:00
parent 5b72d0e4f5
commit b1b9f1789e
2 changed files with 17 additions and 14 deletions

View File

@@ -7260,8 +7260,12 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(unsigned ID) {
setSpecialRefs(Refs, NumRORefs, NumWORefs);
auto VIAndOriginalGUID = getValueInfoFromValueId(ValueID);
// In order to save memory, only record the memprof summaries if this is
// the prevailing copy of a symbol.
if (IsPrevailing && !IsPrevailing(std::get<2>(VIAndOriginalGUID))) {
// the prevailing copy of a symbol. The linker doesn't resolve local
// linkage values so don't check whether those are prevailing.
auto LT = (GlobalValue::LinkageTypes)Flags.Linkage;
if (IsPrevailing &&
!GlobalValue::isLocalLinkage(LT) &&
!IsPrevailing(std::get<2>(VIAndOriginalGUID))) {
PendingCallsites.clear();
PendingAllocs.clear();
}