[CSSPGO] Print "context-nested" instead of "preilnined" for ProfileSummarySection.

Reviewed By: wenlei

Differential Revision: https://reviews.llvm.org/D117141
This commit is contained in:
Hongtao Yu 2022-01-12 12:21:54 -08:00
parent 2e2999cd44
commit ff0b634d97
4 changed files with 12 additions and 13 deletions

View File

@ -195,19 +195,21 @@ enum class SecProfSummaryFlags : uint32_t {
/// The common profile is usually merged from profiles collected
/// from running other targets.
SecFlagPartial = (1 << 0),
/// SecFlagContext means this is context-sensitive profile for
/// SecFlagContext means this is context-sensitive flat profile for
/// CSSPGO
SecFlagFullContext = (1 << 1),
/// SecFlagFSDiscriminator means this profile uses flow-sensitive
/// discriminators.
SecFlagFSDiscriminator = (1 << 2)
SecFlagFSDiscriminator = (1 << 2),
/// SecFlagIsCSNested means this is context-sensitive nested profile for
/// CSSPGO
SecFlagIsCSNested = (1 << 4),
};
enum class SecFuncMetadataFlags : uint32_t {
SecFlagInvalid = 0,
SecFlagIsProbeBased = (1 << 0),
SecFlagHasAttribute = (1 << 1),
SecFlagIsCSNested = (1 << 2),
};
enum class SecFuncOffsetFlags : uint32_t {

View File

@ -655,6 +655,8 @@ std::error_code SampleProfileReaderExtBinaryBase::readOneSection(
Summary->setPartialProfile(true);
if (hasSecFlag(Entry, SecProfSummaryFlags::SecFlagFullContext))
FunctionSamples::ProfileIsCSFlat = ProfileIsCSFlat = true;
if (hasSecFlag(Entry, SecProfSummaryFlags::SecFlagIsCSNested))
FunctionSamples::ProfileIsCSNested = ProfileIsCSNested;
if (hasSecFlag(Entry, SecProfSummaryFlags::SecFlagFSDiscriminator))
FunctionSamples::ProfileIsFS = ProfileIsFS = true;
break;
@ -688,9 +690,6 @@ std::error_code SampleProfileReaderExtBinaryBase::readOneSection(
ProfileIsProbeBased =
hasSecFlag(Entry, SecFuncMetadataFlags::SecFlagIsProbeBased);
FunctionSamples::ProfileIsProbeBased = ProfileIsProbeBased;
ProfileIsCSNested =
hasSecFlag(Entry, SecFuncMetadataFlags::SecFlagIsCSNested);
FunctionSamples::ProfileIsCSNested = ProfileIsCSNested;
bool HasAttribute =
hasSecFlag(Entry, SecFuncMetadataFlags::SecFlagHasAttribute);
if (std::error_code EC = readFuncMetadata(HasAttribute))
@ -1276,6 +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::SecFlagFSDiscriminator))
Flags.append("fs-discriminator,");
break;
@ -1288,8 +1289,6 @@ static std::string getSecFlagsStr(const SecHdrTableEntry &Entry) {
Flags.append("probe,");
if (hasSecFlag(Entry, SecFuncMetadataFlags::SecFlagHasAttribute))
Flags.append("attr,");
if (hasSecFlag(Entry, SecFuncMetadataFlags::SecFlagIsCSNested))
Flags.append("preinlined,");
break;
default:
break;

View File

@ -323,13 +323,13 @@ std::error_code SampleProfileWriterExtBinaryBase::writeOneSection(
setToCompressSection(SecProfileSymbolList);
if (Type == SecFuncMetadata && FunctionSamples::ProfileIsProbeBased)
addSectionFlag(SecFuncMetadata, SecFuncMetadataFlags::SecFlagIsProbeBased);
if (Type == SecFuncMetadata && FunctionSamples::ProfileIsCSNested)
addSectionFlag(SecFuncMetadata, SecFuncMetadataFlags::SecFlagIsCSNested);
if (Type == SecFuncMetadata &&
(FunctionSamples::ProfileIsCSFlat || FunctionSamples::ProfileIsCSNested))
addSectionFlag(SecFuncMetadata, SecFuncMetadataFlags::SecFlagHasAttribute);
if (Type == SecProfSummary && FunctionSamples::ProfileIsCSFlat)
addSectionFlag(SecProfSummary, SecProfSummaryFlags::SecFlagFullContext);
if (Type == SecProfSummary && FunctionSamples::ProfileIsCSNested)
addSectionFlag(SecProfSummary, SecProfSummaryFlags::SecFlagIsCSNested);
if (Type == SecProfSummary && FunctionSamples::ProfileIsFS)
addSectionFlag(SecProfSummary, SecProfSummaryFlags::SecFlagFSDiscriminator);

View File

@ -152,6 +152,4 @@ RUN: FileCheck %s < %t.proftext --match-full-lines --strict-whitespace -check-pr
; PROBE-NEXT: !CFGChecksum: 563022570642068
; PREINLINE: FunctionMetadata {{.*}} Flags: {attr,preinlined}
; PREINLINE: ProfileSummarySection {{.*}} Flags: {context-nested}