llvm::LazyBranchProbabilityInfoPass

This is an alternative analysis pass to BranchProbabilityInfoWrapperPass. The difference is that with this pass the branch probabilities are not computed when the analysis pass is executed but rather when the BPI results is explicitly requested by the analysis client.

Synopsis

Declared in <llvm/Analysis/LazyBranchProbabilityInfo.h>

class LazyBranchProbabilityInfoPass
    : public FunctionPass

Description

There are some additional requirements for any client pass that wants to use the analysis:

1. The pass needs to initialize dependent passes with:

INITIALIZE_PASS_DEPENDENCY(LazyBPIPass)

2. Similarly, getAnalysisUsage should call:

LazyBranchProbabilityInfoPass::getLazyBPIAnalysisUsage(AU)

3. The computed BPI should be requested with getAnalysis<LazyBranchProbabilityInfoPass>().getBPI() before CycleInfo could be invalidated for example by changing the CFG.

Note that it is expected that we wouldn't need this functionality for the new PM since with the new PM, analyses are executed on demand.

Base Classes

NameDescription
FunctionPassFunctionPass class - This class is used to implement most global optimizations. Optimizations should subclass this class if they meet the following constraints:

Member Functions

NameDescription
LazyBranchProbabilityInfoPass [constructor]Default constructor
operator= [deleted]Copy assignment operator
assignPassManager Each pass is responsible for assigning a pass manager to itself. PMS is the stack of available pass manager.
createPrinterPass [virtual]createPrinterPass - Get a function printer pass.
doFinalization [virtual]doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes have run.
doInitialization [virtual]doInitialization - Virtual method overridden by subclasses to do any necessary initialization before any pass is run.
dump
dumpPassStructure [virtual]
getAnalysis getAnalysis<AnalysisType>() - This function is used by subclasses to get to the analysis information that they claim to use by overriding the getAnalysisUsage function.
getAnalysisID
getAnalysisIfAvailable getAnalysisIfAvailable<AnalysisType>() - Subclasses use this function to get analysis information that might be around, for example to update it. This is different than getAnalysis in that it can fail (if the analysis results haven't been computed), so should only be used if you can handle the case when the analysis is not available. This method is often used by transformation APIs to update analysis results for a pass automatically as the transform is performed.
getAnalysisUsage getAnalysisUsage - This function should be overriden by passes that need analysis information to do their job. If a pass specifies that it uses a particular analysis result to this function, it can then use the getAnalysis<AnalysisType>() function, below.
getAsImmutablePass [virtual]
getAsPMDataManager [virtual]
getBPI Compute and return the branch probabilities.
getPassArgument Return a nice clean name for a pass corresponding to that used to enable the pass in opt.
getPassID getPassID - Return the PassID number that corresponds to this pass.
getPassKind
getPassName [virtual]getPassName - Return a nice clean name for a pass. This usually implemented in terms of the name that is registered by one of the Registration templates, but can be overloaded directly.
getPotentialPassManagerType [virtual]Return what kind of Pass Manager can manage this pass.
getResolver
mustPreserveAnalysisID mustPreserveAnalysisID - This method serves the same function as getAnalysisIfAvailable, but works if you just have an AnalysisID. This obviously cannot give you a properly typed instance of the class if you don't have the class name available (use getAnalysisIfAvailable if you do), but it can tell you if you need to preserve the pass at least.
preparePassManager [virtual]Check if available pass managers are suitable for this pass or not.
print [virtual]
printIRUnit [virtual]For --print-changed, serialize the IR unit this pass operates on. The default prints F; MachineFunctionPass prints its MachineFunction. Returns false if there is nothing to report.
releaseMemory [virtual]
runOnFunction [virtual]
setResolver
verifyAnalysis [virtual]verifyAnalysis() - This member can be implemented by a analysis pass to check state of analysis information.

Static Member Functions

NameDescription
createPass
getLazyBPIAnalysisUsage Helper for client passes to set up the analysis usage on behalf of this pass.
lookupPassInfo

Static Data Members

Name
ID

Protected Member Functions

NameDescription
skipFunction Optional passes call this function to check whether the pass should be skipped. This is the case when Attribute::OptimizeNone is set or when optimization bisect is over the limit.

Non-Member Functions

NameDescription
getPassTimerRequest the timer for this legacy-pass-manager's pass instance.
isBitcodeWriterPassCheck whether a pass is a BitcodeWriterPass.
isIRPrintingPassReturn true if a pass is for IR printing.