From 145449b1e420787bb99721a429341fa6be3adfb6 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 3 Jul 2022 16:10:23 +0200 Subject: Vendor import of llvm-project main llvmorg-15-init-15358-g53dc0f107877. --- llvm/lib/ProfileData/SampleProfReader.cpp | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'llvm/lib/ProfileData/SampleProfReader.cpp') diff --git a/llvm/lib/ProfileData/SampleProfReader.cpp b/llvm/lib/ProfileData/SampleProfReader.cpp index 80c02faaba04..280e3c6cb8d1 100644 --- a/llvm/lib/ProfileData/SampleProfReader.cpp +++ b/llvm/lib/ProfileData/SampleProfReader.cpp @@ -23,6 +23,7 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringRef.h" +#include "llvm/IR/Module.h" #include "llvm/IR/ProfileSummary.h" #include "llvm/ProfileData/ProfileCommon.h" #include "llvm/ProfileData/SampleProf.h" @@ -39,7 +40,6 @@ #include #include #include -#include #include #include @@ -348,7 +348,7 @@ std::error_code SampleProfileReaderText::readImpl() { } FProfile.getContext().setAllAttributes(Attributes); if (Attributes & (uint32_t)ContextShouldBeInlined) - ProfileIsCSNested = true; + ProfileIsPreInlined = true; DepthMetadata = Depth; break; } @@ -358,14 +358,14 @@ std::error_code SampleProfileReaderText::readImpl() { assert((CSProfileCount == 0 || CSProfileCount == Profiles.size()) && "Cannot have both context-sensitive and regular profile"); - ProfileIsCSFlat = (CSProfileCount > 0); + ProfileIsCS = (CSProfileCount > 0); assert((TopLevelProbeProfileCount == 0 || TopLevelProbeProfileCount == Profiles.size()) && "Cannot have both probe-based profiles and regular profiles"); ProfileIsProbeBased = (TopLevelProbeProfileCount > 0); FunctionSamples::ProfileIsProbeBased = ProfileIsProbeBased; - FunctionSamples::ProfileIsCSFlat = ProfileIsCSFlat; - FunctionSamples::ProfileIsCSNested = ProfileIsCSNested; + FunctionSamples::ProfileIsCS = ProfileIsCS; + FunctionSamples::ProfileIsPreInlined = ProfileIsPreInlined; if (Result == sampleprof_error::success) computeSummary(); @@ -630,7 +630,7 @@ SampleProfileReaderExtBinaryBase::readContextFromTable() { ErrorOr SampleProfileReaderExtBinaryBase::readSampleContextFromTable() { - if (ProfileIsCSFlat) { + if (ProfileIsCS) { auto FContext(readContextFromTable()); if (std::error_code EC = FContext.getError()) return EC; @@ -654,9 +654,9 @@ std::error_code SampleProfileReaderExtBinaryBase::readOneSection( if (hasSecFlag(Entry, SecProfSummaryFlags::SecFlagPartial)) Summary->setPartialProfile(true); if (hasSecFlag(Entry, SecProfSummaryFlags::SecFlagFullContext)) - FunctionSamples::ProfileIsCSFlat = ProfileIsCSFlat = true; - if (hasSecFlag(Entry, SecProfSummaryFlags::SecFlagIsCSNested)) - FunctionSamples::ProfileIsCSNested = ProfileIsCSNested; + FunctionSamples::ProfileIsCS = ProfileIsCS = true; + if (hasSecFlag(Entry, SecProfSummaryFlags::SecFlagIsPreInlined)) + FunctionSamples::ProfileIsPreInlined = ProfileIsPreInlined = true; if (hasSecFlag(Entry, SecProfSummaryFlags::SecFlagFSDiscriminator)) FunctionSamples::ProfileIsFS = ProfileIsFS = true; break; @@ -777,7 +777,7 @@ std::error_code SampleProfileReaderExtBinaryBase::readFuncProfiles() { } } - if (ProfileIsCSFlat) { + if (ProfileIsCS) { DenseSet FuncGuidsToUse; if (useMD5()) { for (auto Name : FuncsToUse) @@ -847,7 +847,7 @@ std::error_code SampleProfileReaderExtBinaryBase::readFuncProfiles() { } assert((CSProfileCount == 0 || CSProfileCount == Profiles.size()) && "Cannot have both context-sensitive and regular profile"); - assert((!CSProfileCount || ProfileIsCSFlat) && + assert((!CSProfileCount || ProfileIsCS) && "Section flag should be consistent with actual profile"); return sampleprof_error::success; } @@ -1105,7 +1105,7 @@ SampleProfileReaderExtBinaryBase::readFuncMetadata(bool ProfileHasAttribute, FProfile->getContext().setAllAttributes(*Attributes); } - if (!ProfileIsCSFlat) { + if (!ProfileIsCS) { // Read all the attributes for inlined function calls. auto NumCallsites = readNumber(); if (std::error_code EC = NumCallsites.getError()) @@ -1275,8 +1275,8 @@ static std::string getSecFlagsStr(const SecHdrTableEntry &Entry) { Flags.append("partial,"); if (hasSecFlag(Entry, SecProfSummaryFlags::SecFlagFullContext)) Flags.append("context,"); - if (hasSecFlag(Entry, SecProfSummaryFlags::SecFlagIsCSNested)) - Flags.append("context-nested,"); + if (hasSecFlag(Entry, SecProfSummaryFlags::SecFlagIsPreInlined)) + Flags.append("preInlined,"); if (hasSecFlag(Entry, SecProfSummaryFlags::SecFlagFSDiscriminator)) Flags.append("fs-discriminator,"); break; @@ -1828,7 +1828,7 @@ SampleProfileReaderItaniumRemapper::create(std::unique_ptr &B, SampleProfileReader &Reader, LLVMContext &C) { auto Remappings = std::make_unique(); - if (Error E = Remappings->read(*B.get())) { + if (Error E = Remappings->read(*B)) { handleAllErrors( std::move(E), [&](const SymbolRemappingParseError &ParseError) { C.diagnose(DiagnosticInfoSampleProfile(B->getBufferIdentifier(), @@ -1882,7 +1882,6 @@ SampleProfileReader::create(std::unique_ptr &B, LLVMContext &C, Reader->Remapper = std::move(ReaderOrErr.get()); } - FunctionSamples::Format = Reader->getFormat(); if (std::error_code EC = Reader->readHeader()) { return EC; } -- cgit v1.3