class ProfileSummaryInfo

Declaration

class ProfileSummaryInfo { /* full declaration omitted */ };

Description

Analysis providing profile information. This is an immutable analysis pass that provides ability to query global (program-level) profile information. The main APIs are isHotCount and isColdCount that tells whether a given profile count is considered hot/cold based on the profile summary. This also provides convenience methods to check whether a function is hot or cold.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:39

Member Variables

private const llvm::Module* M
private std::unique_ptr<ProfileSummary> Summary
private Optional<uint64_t> HotCountThreshold
private Optional<uint64_t> ColdCountThreshold
private Optional<bool> HasHugeWorkingSetSize
private Optional<bool> HasLargeWorkingSetSize
private DenseMap<int, uint64_t> ThresholdCache

Method Overview

Methods

ProfileSummaryInfo(const llvm::Module& M)

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:61

Parameters

const llvm::Module& M

ProfileSummaryInfo(llvm::ProfileSummaryInfo&& Arg)

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:62

Parameters

llvm::ProfileSummaryInfo&& Arg

Optional<uint64_t> computeThreshold(
    int PercentileCutoff) const

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:55

Parameters

int PercentileCutoff

void computeThresholds()

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:43

uint64_t getColdCountThreshold() const

Description

Returns ColdCountThreshold if set.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:176

uint64_t getHotCountThreshold() const

Description

Returns HotCountThreshold if set.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:172

uint64_t getOrCompColdCountThreshold() const

Description

Returns ColdCountThreshold if set. Recompute HotCountThreshold if not set.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:170

uint64_t getOrCompHotCountThreshold() const

Description

Returns HotCountThreshold if set. Recompute HotCountThreshold if not set.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:167

Optional<uint64_t> getProfileCount(
    const llvm::CallBase& CallInst,
    llvm::BlockFrequencyInfo* BFI,
    bool AllowSynthetic = false) const

Description

Returns the profile count for \p CallInst.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:100

Parameters

const llvm::CallBase& CallInst
llvm::BlockFrequencyInfo* BFI
bool AllowSynthetic = false

bool hasCSInstrumentationProfile() const

Description

Returns true if module \c M has context sensitive instrumentation profile.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:83

bool hasHugeWorkingSetSize() const

Description

Returns true if the working set size of the code is considered huge.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:106

bool hasInstrumentationProfile() const

Description

Returns true if module \c M has instrumentation profile.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:77

bool hasLargeWorkingSetSize() const

Description

Returns true if the working set size of the code is considered large.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:108

bool hasPartialSampleProfile() const

Description

Returns true if module \c M has partial-profile sample profile.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:104

bool hasProfileSummary() const

Description

Returns true if profile summary is available.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:68

bool hasSampleProfile() const

Description

Returns true if module \c M has sample profile.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:71

bool invalidate(
    llvm::Module&,
    const llvm::PreservedAnalyses&,
    ModuleAnalysisManager::Invalidator&)

Description

Handle the invalidation of this information. When used as a result of \c ProfileSummaryAnalysis this method will be called when the module this was computed for changes. Since profile summary is immutable after it is annotated on the module, we return false here.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:94

Parameters

llvm::Module&
const llvm::PreservedAnalyses&
ModuleAnalysisManager::Invalidator&

bool isColdBlock(
    const llvm::BasicBlock* BB,
    llvm::BlockFrequencyInfo* BFI) const

Description

Returns true if BasicBlock \p BB is considered cold.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:148

Parameters

const llvm::BasicBlock* BB
llvm::BlockFrequencyInfo* BFI

bool isColdBlockNthPercentile(
    int PercentileCutoff,
    const llvm::BasicBlock* BB,
    llvm::BlockFrequencyInfo* BFI) const

Description

Returns true if BasicBlock \p BB is considered cold with regard to a given cold percentile cutoff value. PercentileCutoff is encoded as a 6 digit decimal fixed point number, where the first two digits are the whole part. E.g. 995000 for 99.5 percentile.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:159

Parameters

int PercentileCutoff
const llvm::BasicBlock* BB
llvm::BlockFrequencyInfo* BFI

bool isColdCallSite(
    const llvm::CallBase& CB,
    llvm::BlockFrequencyInfo* BFI) const

Description

Returns true if call site \p CB is considered cold.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:164

Parameters

const llvm::CallBase& CB
llvm::BlockFrequencyInfo* BFI

bool isColdCount(uint64_t C) const

Description

Returns true if count \p C is considered cold.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:134

Parameters

uint64_t C

bool isColdCountNthPercentile(
    int PercentileCutoff,
    uint64_t C) const

Description

Returns true if count \p C is considered cold with regard to a given cold percentile cutoff value. PercentileCutoff is encoded as a 6 digit decimal fixed point number, where the first two digits are the whole part. E.g. 995000 for 99.5 percentile.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:144

Parameters

int PercentileCutoff
uint64_t C

bool isFunctionColdInCallGraph(
    const llvm::Function* F,
    llvm::BlockFrequencyInfo& BFI) const

Description

Returns true if \p F contains only cold code.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:117

Parameters

const llvm::Function* F
llvm::BlockFrequencyInfo& BFI

bool isFunctionColdInCallGraphNthPercentile(
    int PercentileCutoff,
    const llvm::Function* F,
    llvm::BlockFrequencyInfo& BFI) const

Description

Returns true if \p F contains cold code with regard to a given cold percentile cutoff value.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:128

Parameters

int PercentileCutoff
const llvm::Function* F
llvm::BlockFrequencyInfo& BFI

bool isFunctionEntryCold(
    const llvm::Function* F) const

Description

Returns true if \p F has cold function entry.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:115

Parameters

const llvm::Function* F

bool isFunctionEntryHot(
    const llvm::Function* F) const

Description

Returns true if \p F has hot function entry.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:110

Parameters

const llvm::Function* F

bool isFunctionHotInCallGraph(
    const llvm::Function* F,
    llvm::BlockFrequencyInfo& BFI) const

Description

Returns true if \p F contains hot code.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:112

Parameters

const llvm::Function* F
llvm::BlockFrequencyInfo& BFI

bool isFunctionHotInCallGraphNthPercentile(
    int PercentileCutoff,
    const llvm::Function* F,
    llvm::BlockFrequencyInfo& BFI) const

Description

Returns true if \p F contains hot code with regard to a given hot percentile cutoff value.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:123

Parameters

int PercentileCutoff
const llvm::Function* F
llvm::BlockFrequencyInfo& BFI

template <bool isHot>
bool isFunctionHotOrColdInCallGraphNthPercentile(
    int PercentileCutoff,
    const llvm::Function* F,
    llvm::BlockFrequencyInfo& BFI) const

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:182

Templates

bool isHot

Parameters

int PercentileCutoff
const llvm::Function* F
llvm::BlockFrequencyInfo& BFI

bool isFunctionHotnessUnknown(
    const llvm::Function& F) const

Description

Returns true if the hotness of \p F is unknown.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:120

Parameters

const llvm::Function& F

bool isHotBlock(
    const llvm::BasicBlock* BB,
    llvm::BlockFrequencyInfo* BFI) const

Description

Returns true if BasicBlock \p BB is considered hot.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:146

Parameters

const llvm::BasicBlock* BB
llvm::BlockFrequencyInfo* BFI

bool isHotBlockNthPercentile(
    int PercentileCutoff,
    const llvm::BasicBlock* BB,
    llvm::BlockFrequencyInfo* BFI) const

Description

Returns true if BasicBlock \p BB is considered hot with regard to a given hot percentile cutoff value. PercentileCutoff is encoded as a 6 digit decimal fixed point number, where the first two digits are the whole part. E.g. 995000 for 99.5 percentile.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:153

Parameters

int PercentileCutoff
const llvm::BasicBlock* BB
llvm::BlockFrequencyInfo* BFI

bool isHotCallSite(
    const llvm::CallBase& CB,
    llvm::BlockFrequencyInfo* BFI) const

Description

Returns true if the call site \p CB is considered hot.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:162

Parameters

const llvm::CallBase& CB
llvm::BlockFrequencyInfo* BFI

bool isHotCount(uint64_t C) const

Description

Returns true if count \p C is considered hot.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:132

Parameters

uint64_t C

bool isHotCountNthPercentile(int PercentileCutoff,
                             uint64_t C) const

Description

Returns true if count \p C is considered hot with regard to a given hot percentile cutoff value. PercentileCutoff is encoded as a 6 digit decimal fixed point number, where the first two digits are the whole part. E.g. 995000 for 99.5 percentile.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:139

Parameters

int PercentileCutoff
uint64_t C

template <bool isHot>
bool isHotOrColdBlockNthPercentile(
    int PercentileCutoff,
    const llvm::BasicBlock* BB,
    llvm::BlockFrequencyInfo* BFI) const

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:187

Templates

bool isHot

Parameters

int PercentileCutoff
const llvm::BasicBlock* BB
llvm::BlockFrequencyInfo* BFI

template <bool isHot>
bool isHotOrColdCountNthPercentile(
    int PercentileCutoff,
    uint64_t C) const

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:185

Templates

bool isHot

Parameters

int PercentileCutoff
uint64_t C

void refresh()

Description

If no summary is present, attempt to refresh.

Declared at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:65