LLVM 17.0.0git
Classes | Namespaces | Macros | Typedefs | Functions | Variables
PGOInstrumentation.cpp File Reference
#include "llvm/Transforms/Instrumentation/PGOInstrumentation.h"
#include "ValueProfileCollector.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/ADT/iterator.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Analysis/BlockFrequencyInfo.h"
#include "llvm/Analysis/BranchProbabilityInfo.h"
#include "llvm/Analysis/CFG.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/MemoryBuiltins.h"
#include "llvm/Analysis/MemoryProfileInfo.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/Analysis/ProfileSummaryInfo.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/Comdat.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/EHPersonalities.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InstVisitor.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/MDBuilder.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
#include "llvm/IR/ProfDataUtils.h"
#include "llvm/IR/ProfileSummary.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"
#include "llvm/ProfileData/InstrProf.h"
#include "llvm/ProfileData/InstrProfReader.h"
#include "llvm/Support/BLAKE3.h"
#include "llvm/Support/BranchProbability.h"
#include "llvm/Support/CRC.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/DOTGraphTraits.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/GraphWriter.h"
#include "llvm/Support/HashBuilder.h"
#include "llvm/Support/VirtualFileSystem.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TargetParser/Triple.h"
#include "llvm/Transforms/Instrumentation.h"
#include "llvm/Transforms/Instrumentation/BlockCoverageInference.h"
#include "llvm/Transforms/Instrumentation/CFGMST.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/MisExpect.h"
#include "llvm/Transforms/Utils/ModuleUtils.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <map>
#include <memory>
#include <numeric>
#include <optional>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#include "llvm/ProfileData/InstrProfData.inc"

Go to the source code of this file.

Classes

struct  llvm::GraphTraits< PGOUseFunc * >
 
struct  llvm::DOTGraphTraits< PGOUseFunc * >
 

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
 

Macros

#define DEBUG_TYPE   "pgo-instrumentation"
 
#define VALUE_PROF_KIND(Enumerator, Value, Descr)   Descr,
 

Typedefs

using ProfileCount = Function::ProfileCount
 
using VPCandidateInfo = ValueProfileCollector::CandidateInfo
 

Functions

 STATISTIC (NumOfPGOInstrument, "Number of edges instrumented.")
 
 STATISTIC (NumOfPGOSelectInsts, "Number of select instruction instrumented.")
 
 STATISTIC (NumOfPGOMemIntrinsics, "Number of mem intrinsics instrumented.")
 
 STATISTIC (NumOfPGOEdge, "Number of edges.")
 
 STATISTIC (NumOfPGOBB, "Number of basic-blocks.")
 
 STATISTIC (NumOfPGOSplit, "Number of critical edge splits.")
 
 STATISTIC (NumOfPGOFunc, "Number of functions having valid profile counts.")
 
 STATISTIC (NumOfPGOMismatch, "Number of functions having mismatch profile.")
 
 STATISTIC (NumOfPGOMissing, "Number of functions without profile.")
 
 STATISTIC (NumOfMemProfMissing, "Number of functions without memory profile.")
 
 STATISTIC (NumOfPGOICall, "Number of indirect call value instrumentations.")
 
 STATISTIC (NumOfCSPGOInstrument, "Number of edges instrumented in CSPGO.")
 
 STATISTIC (NumOfCSPGOSelectInsts, "Number of select instruction instrumented in CSPGO.")
 
 STATISTIC (NumOfCSPGOMemIntrinsics, "Number of mem intrinsics instrumented in CSPGO.")
 
 STATISTIC (NumOfCSPGOEdge, "Number of edges in CSPGO.")
 
 STATISTIC (NumOfCSPGOBB, "Number of basic-blocks in CSPGO.")
 
 STATISTIC (NumOfCSPGOSplit, "Number of critical edge splits in CSPGO.")
 
 STATISTIC (NumOfCSPGOFunc, "Number of functions having valid profile counts in CSPGO.")
 
 STATISTIC (NumOfCSPGOMismatch, "Number of functions having mismatch profile in CSPGO.")
 
 STATISTIC (NumOfCSPGOMissing, "Number of functions without profile in CSPGO.")
 
 STATISTIC (NumCoveredBlocks, "Number of basic blocks that were executed")
 
cl::opt< boolllvm::NoPGOWarnMismatch ("no-pgo-warn-mismatch", cl::init(false), cl::Hidden, cl::desc("Use this option to turn off/on " "warnings about profile cfg mismatch."))
 
static std::string getBranchCondString (Instruction *TI)
 
static GlobalVariablecreateIRLevelProfileFlagVar (Module &M, bool IsCS)
 
static bool canRenameComdat (Function &F, std::unordered_multimap< Comdat *, GlobalValue * > &ComdatMembers)
 
static void populateEHOperandBundle (VPCandidateInfo &Cand, DenseMap< BasicBlock *, ColorVector > &BlockColors, SmallVectorImpl< OperandBundleDef > &OpBundles)
 
static void instrumentOneFunc (Function &F, Module *M, TargetLibraryInfo &TLI, BranchProbabilityInfo *BPI, BlockFrequencyInfo *BFI, std::unordered_multimap< Comdat *, GlobalValue * > &ComdatMembers, bool IsCS)
 
static uint64_t sumEdgeCount (const ArrayRef< PGOUseEdge * > Edges)
 
static void setupBBInfoEdges (FuncPGOInstrumentation< PGOUseEdge, PGOUseBBInfo > &FuncInfo)
 Set up InEdges/OutEdges for all BBs in the MST.
 
static void annotateFunctionWithHashMismatch (Function &F, LLVMContext &ctx)
 
static void addCallsiteMetadata (Instruction &I, std::vector< uint64_t > &InlinedCallStack, LLVMContext &Ctx)
 
static uint64_t computeStackId (GlobalValue::GUID Function, uint32_t LineOffset, uint32_t Column)
 
static uint64_t computeStackId (const memprof::Frame &Frame)
 
static void addCallStack (CallStackTrie &AllocTrie, const AllocationInfo *AllocInfo)
 
static bool stackFrameIncludesInlinedCallStack (ArrayRef< Frame > ProfileCallStack, ArrayRef< uint64_t > InlinedCallStack, unsigned StartIndex=0)
 
static bool isIndirectBrTarget (BasicBlock *BB)
 
static void collectComdatMembers (Module &M, std::unordered_multimap< Comdat *, GlobalValue * > &ComdatMembers)
 
static bool skipPGO (const Function &F)
 
static bool InstrumentAllFunctions (Module &M, function_ref< TargetLibraryInfo &(Function &)> LookupTLI, function_ref< BranchProbabilityInfo *(Function &)> LookupBPI, function_ref< BlockFrequencyInfo *(Function &)> LookupBFI, bool IsCS)
 
static void fixFuncEntryCount (PGOUseFunc &Func, LoopInfo &LI, BranchProbabilityInfo &NBPI)
 
static void verifyFuncBFI (PGOUseFunc &Func, LoopInfo &LI, BranchProbabilityInfo &NBPI, uint64_t HotCountThreshold, uint64_t ColdCountThreshold)
 
static bool annotateAllFunctions (Module &M, StringRef ProfileFileName, StringRef ProfileRemappingFileName, vfs::FileSystem &FS, function_ref< TargetLibraryInfo &(Function &)> LookupTLI, function_ref< BranchProbabilityInfo *(Function &)> LookupBPI, function_ref< BlockFrequencyInfo *(Function &)> LookupBFI, ProfileSummaryInfo *PSI, bool IsCS)
 
static std::string getSimpleNodeName (const BasicBlock *Node)
 
void llvm::setIrrLoopHeaderMetadata (Module *M, Instruction *TI, uint64_t Count)
 

Variables

static cl::opt< std::string > PGOTestProfileFile ("pgo-test-profile-file", cl::init(""), cl::Hidden, cl::value_desc("filename"), cl::desc("Specify the path of profile data file. This is" "mainly for test purpose."))
 
static cl::opt< std::string > PGOTestProfileRemappingFile ("pgo-test-profile-remapping-file", cl::init(""), cl::Hidden, cl::value_desc("filename"), cl::desc("Specify the path of profile remapping file. This is mainly for " "test purpose."))
 
static cl::opt< boolDisableValueProfiling ("disable-vp", cl::init(false), cl::Hidden, cl::desc("Disable Value Profiling"))
 
static cl::opt< unsignedMaxNumAnnotations ("icp-max-annotations", cl::init(3), cl::Hidden, cl::desc("Max number of annotations for a single indirect " "call callsite"))
 
static cl::opt< unsignedMaxNumMemOPAnnotations ("memop-max-annotations", cl::init(4), cl::Hidden, cl::desc("Max number of preicise value annotations for a single memop" "intrinsic"))
 
static cl::opt< boolDoComdatRenaming ("do-comdat-renaming", cl::init(false), cl::Hidden, cl::desc("Append function hash to the name of COMDAT function to avoid " "function hash mismatch due to the preinliner"))
 
static cl::opt< boolPGOWarnMissing ("pgo-warn-missing-function", cl::init(false), cl::Hidden, cl::desc("Use this option to turn on/off " "warnings about missing profile data for " "functions."))
 
static cl::opt< boolNoPGOWarnMismatchComdatWeak ("no-pgo-warn-mismatch-comdat-weak", cl::init(true), cl::Hidden, cl::desc("The option is used to turn on/off " "warnings about hash mismatch for comdat " "or weak functions."))
 
static cl::opt< boolPGOInstrSelect ("pgo-instr-select", cl::init(true), cl::Hidden, cl::desc("Use this option to turn on/off SELECT " "instruction instrumentation. "))
 
static cl::opt< PGOViewCountsTypePGOViewRawCounts ("pgo-view-raw-counts", cl::Hidden, cl::desc("A boolean option to show CFG dag or text " "with raw profile counts from " "profile data. See also option " "-pgo-view-counts. To limit graph " "display to only one function, use " "filtering option -view-bfi-func-name."), cl::values(clEnumValN(PGOVCT_None, "none", "do not show."), clEnumValN(PGOVCT_Graph, "graph", "show a graph."), clEnumValN(PGOVCT_Text, "text", "show in text.")))
 
static cl::opt< boolPGOInstrMemOP ("pgo-instr-memop", cl::init(true), cl::Hidden, cl::desc("Use this option to turn on/off " "memory intrinsic size profiling."))
 
static cl::opt< boolEmitBranchProbability ("pgo-emit-branch-prob", cl::init(false), cl::Hidden, cl::desc("When this option is on, the annotated " "branch probability will be emitted as " "optimization remarks: -{Rpass|" "pass-remarks}=pgo-instrumentation"))
 
static cl::opt< boolPGOInstrumentEntry ("pgo-instrument-entry", cl::init(false), cl::Hidden, cl::desc("Force to instrument function entry basicblock."))
 
static cl::opt< boolPGOFunctionEntryCoverage ("pgo-function-entry-coverage", cl::Hidden, cl::desc("Use this option to enable function entry coverage instrumentation."))
 
static cl::opt< boolPGOBlockCoverage ("pgo-block-coverage", cl::desc("Use this option to enable basic block coverage instrumentation"))
 
static cl::opt< boolPGOViewBlockCoverageGraph ("pgo-view-block-coverage-graph", cl::desc("Create a dot file of CFGs with block " "coverage inference information"))
 
static cl::opt< boolPGOTemporalInstrumentation ("pgo-temporal-instrumentation", cl::desc("Use this option to enable temporal instrumentation"))
 
static cl::opt< boolPGOFixEntryCount ("pgo-fix-entry-count", cl::init(true), cl::Hidden, cl::desc("Fix function entry count in profile use."))
 
static cl::opt< boolPGOVerifyHotBFI ("pgo-verify-hot-bfi", cl::init(false), cl::Hidden, cl::desc("Print out the non-match BFI count if a hot raw profile count " "becomes non-hot, or a cold raw profile count becomes hot. " "The print is enabled under -Rpass-analysis=pgo, or " "internal option -pass-remakrs-analysis=pgo."))
 
static cl::opt< boolPGOVerifyBFI ("pgo-verify-bfi", cl::init(false), cl::Hidden, cl::desc("Print out mismatched BFI counts after setting profile metadata " "The print is enabled under -Rpass-analysis=pgo, or " "internal option -pass-remakrs-analysis=pgo."))
 
static cl::opt< unsignedPGOVerifyBFIRatio ("pgo-verify-bfi-ratio", cl::init(2), cl::Hidden, cl::desc("Set the threshold for pgo-verify-bfi: only print out " "mismatched BFI if the difference percentage is greater than " "this value (in percentage)."))
 
static cl::opt< unsignedPGOVerifyBFICutoff ("pgo-verify-bfi-cutoff", cl::init(5), cl::Hidden, cl::desc("Set the threshold for pgo-verify-bfi: skip the counts whose " "profile count value is below."))
 
static cl::opt< std::string > PGOTraceFuncHash ("pgo-trace-func-hash", cl::init("-"), cl::Hidden, cl::value_desc("function name"), cl::desc("Trace the hash of the function with this name."))
 
static cl::opt< unsignedPGOFunctionSizeThreshold ("pgo-function-size-threshold", cl::Hidden, cl::desc("Do not instrument functions smaller than this threshold."))
 
static cl::opt< boolMatchMemProf ("pgo-match-memprof", cl::init(true), cl::Hidden, cl::desc("Perform matching and annotation of memprof profiles."))
 
static cl::opt< unsignedPGOFunctionCriticalEdgeThreshold ("pgo-critical-edge-threshold", cl::init(20000), cl::Hidden, cl::desc("Do not instrument functions with the number of critical edges " " greater than this threshold."))
 
static cl::opt< boolPGOOldCFGHashing ("pgo-instr-old-cfg-hashing", cl::init(false), cl::Hidden, cl::desc("Use the old CFG function hashing"))
 
static const charValueProfKindDescr []
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "pgo-instrumentation"

Definition at line 138 of file PGOInstrumentation.cpp.

◆ VALUE_PROF_KIND

#define VALUE_PROF_KIND (   Enumerator,
  Value,
  Descr 
)    Descr,

Typedef Documentation

◆ ProfileCount

Definition at line 135 of file PGOInstrumentation.cpp.

◆ VPCandidateInfo

Definition at line 136 of file PGOInstrumentation.cpp.

Function Documentation

◆ addCallsiteMetadata()

static void addCallsiteMetadata ( Instruction I,
std::vector< uint64_t > &  InlinedCallStack,
LLVMContext Ctx 
)
static

Definition at line 1306 of file PGOInstrumentation.cpp.

References llvm::memprof::buildCallstackMetadata(), and I.

◆ addCallStack()

static void addCallStack ( CallStackTrie AllocTrie,
const AllocationInfo AllocInfo 
)
static

◆ annotateAllFunctions()

static bool annotateAllFunctions ( Module M,
StringRef  ProfileFileName,
StringRef  ProfileRemappingFileName,
vfs::FileSystem FS,
function_ref< TargetLibraryInfo &(Function &)>  LookupTLI,
function_ref< BranchProbabilityInfo *(Function &)>  LookupBPI,
function_ref< BlockFrequencyInfo *(Function &)>  LookupBFI,
ProfileSummaryInfo PSI,
bool  IsCS 
)
static

◆ annotateFunctionWithHashMismatch()

static void annotateFunctionWithHashMismatch ( Function F,
LLVMContext ctx 
)
static

◆ canRenameComdat()

static bool canRenameComdat ( Function F,
std::unordered_multimap< Comdat *, GlobalValue * > &  ComdatMembers 
)
static

◆ collectComdatMembers()

static void collectComdatMembers ( Module M,
std::unordered_multimap< Comdat *, GlobalValue * > &  ComdatMembers 
)
static

Definition at line 2010 of file PGOInstrumentation.cpp.

References llvm::CallingConv::C, DoComdatRenaming, and F.

Referenced by annotateAllFunctions(), and InstrumentAllFunctions().

◆ computeStackId() [1/2]

static uint64_t computeStackId ( const memprof::Frame Frame)
static

◆ computeStackId() [2/2]

static uint64_t computeStackId ( GlobalValue::GUID  Function,
uint32_t  LineOffset,
uint32_t  Column 
)
static

◆ createIRLevelProfileFlagVar()

static GlobalVariable * createIRLevelProfileFlagVar ( Module M,
bool  IsCS 
)
static

◆ fixFuncEntryCount()

static void fixFuncEntryCount ( PGOUseFunc &  Func,
LoopInfo LI,
BranchProbabilityInfo NBPI 
)
static

◆ getBranchCondString()

static std::string getBranchCondString ( Instruction TI)
static

◆ getSimpleNodeName()

static std::string getSimpleNodeName ( const BasicBlock Node)
static

◆ InstrumentAllFunctions()

static bool InstrumentAllFunctions ( Module M,
function_ref< TargetLibraryInfo &(Function &)>  LookupTLI,
function_ref< BranchProbabilityInfo *(Function &)>  LookupBPI,
function_ref< BlockFrequencyInfo *(Function &)>  LookupBFI,
bool  IsCS 
)
static

◆ instrumentOneFunc()

static void instrumentOneFunc ( Function F,
Module M,
TargetLibraryInfo TLI,
BranchProbabilityInfo BPI,
BlockFrequencyInfo BFI,
std::unordered_multimap< Comdat *, GlobalValue * > &  ComdatMembers,
bool  IsCS 
)
static

◆ isIndirectBrTarget()

static bool isIndirectBrTarget ( BasicBlock BB)
static

Definition at line 1889 of file PGOInstrumentation.cpp.

References llvm::predecessors().

◆ populateEHOperandBundle()

static void populateEHOperandBundle ( VPCandidateInfo Cand,
DenseMap< BasicBlock *, ColorVector > &  BlockColors,
SmallVectorImpl< OperandBundleDef > &  OpBundles 
)
static

◆ setupBBInfoEdges()

static void setupBBInfoEdges ( FuncPGOInstrumentation< PGOUseEdge, PGOUseBBInfo > &  FuncInfo)
static

Set up InEdges/OutEdges for all BBs in the MST.

Definition at line 1183 of file PGOInstrumentation.cpp.

References E.

◆ skipPGO()

static bool skipPGO ( const Function F)
static

◆ stackFrameIncludesInlinedCallStack()

static bool stackFrameIncludesInlinedCallStack ( ArrayRef< Frame ProfileCallStack,
ArrayRef< uint64_t InlinedCallStack,
unsigned  StartIndex = 0 
)
static

◆ STATISTIC() [1/21]

STATISTIC ( NumCoveredBlocks  ,
"Number of basic blocks that were executed"   
)

◆ STATISTIC() [2/21]

STATISTIC ( NumOfCSPGOBB  ,
"Number of basic-blocks in CSPGO."   
)

◆ STATISTIC() [3/21]

STATISTIC ( NumOfCSPGOEdge  ,
"Number of edges in CSPGO."   
)

◆ STATISTIC() [4/21]

STATISTIC ( NumOfCSPGOFunc  ,
"Number of functions having valid profile counts in CSPGO."   
)

◆ STATISTIC() [5/21]

STATISTIC ( NumOfCSPGOInstrument  ,
"Number of edges instrumented in CSPGO."   
)

◆ STATISTIC() [6/21]

STATISTIC ( NumOfCSPGOMemIntrinsics  ,
"Number of mem intrinsics instrumented in CSPGO."   
)

◆ STATISTIC() [7/21]

STATISTIC ( NumOfCSPGOMismatch  ,
"Number of functions having mismatch profile in CSPGO."   
)

◆ STATISTIC() [8/21]

STATISTIC ( NumOfCSPGOMissing  ,
"Number of functions without profile in CSPGO."   
)

◆ STATISTIC() [9/21]

STATISTIC ( NumOfCSPGOSelectInsts  ,
"Number of select instruction instrumented in CSPGO."   
)

◆ STATISTIC() [10/21]

STATISTIC ( NumOfCSPGOSplit  ,
"Number of critical edge splits in CSPGO."   
)

◆ STATISTIC() [11/21]

STATISTIC ( NumOfMemProfMissing  ,
"Number of functions without memory profile."   
)

◆ STATISTIC() [12/21]

STATISTIC ( NumOfPGOBB  ,
"Number of basic-blocks."   
)

◆ STATISTIC() [13/21]

STATISTIC ( NumOfPGOEdge  ,
"Number of edges."   
)

◆ STATISTIC() [14/21]

STATISTIC ( NumOfPGOFunc  ,
"Number of functions having valid profile counts."   
)

◆ STATISTIC() [15/21]

STATISTIC ( NumOfPGOICall  ,
"Number of indirect call value instrumentations."   
)

◆ STATISTIC() [16/21]

STATISTIC ( NumOfPGOInstrument  ,
"Number of edges instrumented."   
)

◆ STATISTIC() [17/21]

STATISTIC ( NumOfPGOMemIntrinsics  ,
"Number of mem intrinsics instrumented."   
)

◆ STATISTIC() [18/21]

STATISTIC ( NumOfPGOMismatch  ,
"Number of functions having mismatch profile."   
)

◆ STATISTIC() [19/21]

STATISTIC ( NumOfPGOMissing  ,
"Number of functions without profile."   
)

◆ STATISTIC() [20/21]

STATISTIC ( NumOfPGOSelectInsts  ,
"Number of select instruction instrumented."   
)

◆ STATISTIC() [21/21]

STATISTIC ( NumOfPGOSplit  ,
"Number of critical edge splits."   
)

◆ sumEdgeCount()

static uint64_t sumEdgeCount ( const ArrayRef< PGOUseEdge * >  Edges)
static

Definition at line 1054 of file PGOInstrumentation.cpp.

References E, and llvm::Total.

◆ verifyFuncBFI()

static void verifyFuncBFI ( PGOUseFunc &  Func,
LoopInfo LI,
BranchProbabilityInfo NBPI,
uint64_t  HotCountThreshold,
uint64_t  ColdCountThreshold 
)
static

Variable Documentation

◆ DisableValueProfiling

cl::opt< bool > DisableValueProfiling("disable-vp", cl::init(false), cl::Hidden, cl::desc("Disable Value Profiling")) ( "disable-vp"  ,
cl::init(false)  ,
cl::Hidden  ,
cl::desc("Disable Value Profiling")   
)
static

Referenced by instrumentOneFunc().

◆ DoComdatRenaming

cl::opt< bool > DoComdatRenaming("do-comdat-renaming", cl::init(false), cl::Hidden, cl::desc("Append function hash to the name of COMDAT function to avoid " "function hash mismatch due to the preinliner")) ( "do-comdat-renaming"  ,
cl::init(false)  ,
cl::Hidden  ,
cl::desc("Append function hash to the name of COMDAT function to avoid " "function hash mismatch due to the preinliner")   
)
static

◆ EmitBranchProbability

cl::opt< bool > EmitBranchProbability("pgo-emit-branch-prob", cl::init(false), cl::Hidden, cl::desc("When this option is on, the annotated " "branch probability will be emitted as " "optimization remarks: -{Rpass|" "pass-remarks}=pgo-instrumentation")) ( "pgo-emit-branch-prob"  ,
cl::init(false)  ,
cl::Hidden  ,
cl::desc("When this option is on, the annotated " "branch probability will be emitted as " "optimization remarks: -{Rpass|" "pass-remarks}=pgo-instrumentation")   
)
static

Referenced by llvm::setProfMetadata().

◆ MatchMemProf

cl::opt< bool > MatchMemProf("pgo-match-memprof", cl::init(true), cl::Hidden, cl::desc("Perform matching and annotation of memprof profiles.")) ( "pgo-match-memprof"  ,
cl::init(true ,
cl::Hidden  ,
cl::desc("Perform matching and annotation of memprof profiles.")   
)
static

◆ MaxNumAnnotations

cl::opt< unsigned > MaxNumAnnotations("icp-max-annotations", cl::init(3), cl::Hidden, cl::desc("Max number of annotations for a single indirect " "call callsite")) ( "icp-max-annotations"  ,
cl::init(3)  ,
cl::Hidden  ,
cl::desc("Max number of annotations for a single indirect " "call callsite")   
)
static

◆ MaxNumMemOPAnnotations

cl::opt< unsigned > MaxNumMemOPAnnotations("memop-max-annotations", cl::init(4), cl::Hidden, cl::desc("Max number of preicise value annotations for a single memop" "intrinsic")) ( "memop-max-annotations"  ,
cl::init(4)  ,
cl::Hidden  ,
cl::desc("Max number of preicise value annotations for a single memop" "intrinsic")   
)
static

◆ NoPGOWarnMismatchComdatWeak

cl::opt< bool > NoPGOWarnMismatchComdatWeak("no-pgo-warn-mismatch-comdat-weak", cl::init(true), cl::Hidden, cl::desc("The option is used to turn on/off " "warnings about hash mismatch for comdat " "or weak functions.")) ( "no-pgo-warn-mismatch-comdat-weak"  ,
cl::init(true ,
cl::Hidden  ,
cl::desc("The option is used to turn on/off " "warnings about hash mismatch for comdat " "or weak functions.")   
)
static

◆ PGOBlockCoverage

cl::opt< bool > PGOBlockCoverage("pgo-block-coverage", cl::desc("Use this option to enable basic block coverage instrumentation")) ( "pgo-block-coverage"  ,
cl::desc("Use this option to enable basic block coverage instrumentation")   
)
static

◆ PGOFixEntryCount

cl::opt< bool > PGOFixEntryCount("pgo-fix-entry-count", cl::init(true), cl::Hidden, cl::desc("Fix function entry count in profile use.")) ( "pgo-fix-entry-count"  ,
cl::init(true ,
cl::Hidden  ,
cl::desc("Fix function entry count in profile use.")   
)
static

Referenced by annotateAllFunctions().

◆ PGOFunctionCriticalEdgeThreshold

cl::opt< unsigned > PGOFunctionCriticalEdgeThreshold("pgo-critical-edge-threshold", cl::init(20000), cl::Hidden, cl::desc("Do not instrument functions with the number of critical edges " " greater than this threshold.")) ( "pgo-critical-edge-threshold"  ,
cl::init(20000)  ,
cl::Hidden  ,
cl::desc("Do not instrument functions with the number of critical edges " " greater than this threshold.")   
)
static

Referenced by skipPGO().

◆ PGOFunctionEntryCoverage

cl::opt< bool > PGOFunctionEntryCoverage("pgo-function-entry-coverage", cl::Hidden, cl::desc( "Use this option to enable function entry coverage instrumentation.")) ( "pgo-function-entry-coverage"  ,
cl::Hidden  ,
cl::desc( "Use this option to enable function entry coverage instrumentation.")   
)
static

◆ PGOFunctionSizeThreshold

cl::opt< unsigned > PGOFunctionSizeThreshold("pgo-function-size-threshold", cl::Hidden, cl::desc("Do not instrument functions smaller than this threshold.")) ( "pgo-function-size-threshold"  ,
cl::Hidden  ,
cl::desc("Do not instrument functions smaller than this threshold.")   
)
static

Referenced by skipPGO().

◆ PGOInstrMemOP

cl::opt< bool > PGOInstrMemOP("pgo-instr-memop", cl::init(true), cl::Hidden, cl::desc("Use this option to turn on/off " "memory intrinsic size profiling.")) ( "pgo-instr-memop"  ,
cl::init(true ,
cl::Hidden  ,
cl::desc("Use this option to turn on/off " "memory intrinsic size profiling.")   
)
static

Referenced by instrumentOneFunc().

◆ PGOInstrSelect

cl::opt< bool > PGOInstrSelect("pgo-instr-select", cl::init(true), cl::Hidden, cl::desc("Use this option to turn on/off SELECT " "instruction instrumentation. ")) ( "pgo-instr-select"  ,
cl::init(true ,
cl::Hidden  ,
cl::desc("Use this option to turn on/off SELECT " "instruction instrumentation. ")   
)
static

◆ PGOInstrumentEntry

cl::opt< bool > PGOInstrumentEntry("pgo-instrument-entry", cl::init(false), cl::Hidden, cl::desc("Force to instrument function entry basicblock.")) ( "pgo-instrument-entry"  ,
cl::init(false)  ,
cl::Hidden  ,
cl::desc("Force to instrument function entry basicblock.")   
)
static

◆ PGOOldCFGHashing

cl::opt< bool > PGOOldCFGHashing("pgo-instr-old-cfg-hashing", cl::init(false), cl::Hidden, cl::desc("Use the old CFG function hashing")) ( "pgo-instr-old-cfg-hashing"  ,
cl::init(false)  ,
cl::Hidden  ,
cl::desc("Use the old CFG function hashing")   
)
static

◆ PGOTemporalInstrumentation

cl::opt< bool > PGOTemporalInstrumentation("pgo-temporal-instrumentation", cl::desc("Use this option to enable temporal instrumentation")) ( "pgo-temporal-instrumentation"  ,
cl::desc("Use this option to enable temporal instrumentation")   
)
static

◆ PGOTestProfileFile

cl::opt< std::string > PGOTestProfileFile("pgo-test-profile-file", cl::init(""), cl::Hidden, cl::value_desc("filename"), cl::desc("Specify the path of profile data file. This is" "mainly for test purpose.")) ( "pgo-test-profile-file"  ,
cl::init("")  ,
cl::Hidden  ,
cl::value_desc("filename")  ,
cl::desc("Specify the path of profile data file. This is" "mainly for test purpose.")   
)
static

◆ PGOTestProfileRemappingFile

cl::opt< std::string > PGOTestProfileRemappingFile("pgo-test-profile-remapping-file", cl::init(""), cl::Hidden, cl::value_desc("filename"), cl::desc("Specify the path of profile remapping file. This is mainly for " "test purpose.")) ( "pgo-test-profile-remapping-file"  ,
cl::init("")  ,
cl::Hidden  ,
cl::value_desc("filename")  ,
cl::desc("Specify the path of profile remapping file. This is mainly for " "test purpose.")   
)
static

◆ PGOTraceFuncHash

cl::opt< std::string > PGOTraceFuncHash("pgo-trace-func-hash", cl::init("-"), cl::Hidden, cl::value_desc("function name"), cl::desc("Trace the hash of the function with this name.")) ( "pgo-trace-func-hash"  ,
cl::init("-")  ,
cl::Hidden  ,
cl::value_desc("function name")  ,
cl::desc("Trace the hash of the function with this name.")   
)
static

◆ PGOVerifyBFI

cl::opt< bool > PGOVerifyBFI("pgo-verify-bfi", cl::init(false), cl::Hidden, cl::desc("Print out mismatched BFI counts after setting profile metadata " "The print is enabled under -Rpass-analysis=pgo, or " "internal option -pass-remakrs-analysis=pgo.")) ( "pgo-verify-bfi"  ,
cl::init(false)  ,
cl::Hidden  ,
cl::desc("Print out mismatched BFI counts after setting profile metadata " "The print is enabled under -Rpass-analysis=pgo, or " "internal option -pass-remakrs-analysis=pgo.")   
)
static

Referenced by annotateAllFunctions().

◆ PGOVerifyBFICutoff

cl::opt< unsigned > PGOVerifyBFICutoff("pgo-verify-bfi-cutoff", cl::init(5), cl::Hidden, cl::desc("Set the threshold for pgo-verify-bfi: skip the counts whose " "profile count value is below.")) ( "pgo-verify-bfi-cutoff"  ,
cl::init(5)  ,
cl::Hidden  ,
cl::desc("Set the threshold for pgo-verify-bfi: skip the counts whose " "profile count value is below.")   
)
static

Referenced by verifyFuncBFI().

◆ PGOVerifyBFIRatio

cl::opt< unsigned > PGOVerifyBFIRatio("pgo-verify-bfi-ratio", cl::init(2), cl::Hidden, cl::desc("Set the threshold for pgo-verify-bfi: only print out " "mismatched BFI if the difference percentage is greater than " "this value (in percentage).")) ( "pgo-verify-bfi-ratio"  ,
cl::init(2)  ,
cl::Hidden  ,
cl::desc("Set the threshold for pgo-verify-bfi: only print out " "mismatched BFI if the difference percentage is greater than " "this value (in percentage).")   
)
static

Referenced by verifyFuncBFI().

◆ PGOVerifyHotBFI

cl::opt< bool > PGOVerifyHotBFI("pgo-verify-hot-bfi", cl::init(false), cl::Hidden, cl::desc("Print out the non-match BFI count if a hot raw profile count " "becomes non-hot, or a cold raw profile count becomes hot. " "The print is enabled under -Rpass-analysis=pgo, or " "internal option -pass-remakrs-analysis=pgo.")) ( "pgo-verify-hot-bfi"  ,
cl::init(false)  ,
cl::Hidden  ,
cl::desc("Print out the non-match BFI count if a hot raw profile count " "becomes non-hot, or a cold raw profile count becomes hot. " "The print is enabled under -Rpass-analysis=pgo, or " "internal option -pass-remakrs-analysis=pgo.")   
)
static

◆ PGOViewBlockCoverageGraph

cl::opt< bool > PGOViewBlockCoverageGraph("pgo-view-block-coverage-graph", cl::desc("Create a dot file of CFGs with block " "coverage inference information")) ( "pgo-view-block-coverage-graph"  ,
cl::desc("Create a dot file of CFGs with block " "coverage inference information")   
)
static

◆ PGOViewRawCounts

cl::opt< PGOViewCountsType > PGOViewRawCounts("pgo-view-raw-counts", cl::Hidden, cl::desc("A boolean option to show CFG dag or text " "with raw profile counts from " "profile data. See also option " "-pgo-view-counts. To limit graph " "display to only one function, use " "filtering option -view-bfi-func-name."), cl::values(clEnumValN(PGOVCT_None, "none", "do not show."), clEnumValN(PGOVCT_Graph, "graph", "show a graph."), clEnumValN(PGOVCT_Text, "text", "show in text."))) ( "pgo-view-raw-counts"  ,
cl::Hidden  ,
cl::desc("A boolean option to show CFG dag or text " "with raw profile counts from " "profile data. See also option " "-pgo-view-counts. To limit graph " "display to only one function, use " "filtering option -view-bfi-func-name.")  ,
cl::values(clEnumValN(PGOVCT_None, "none", "do not show."), clEnumValN(PGOVCT_Graph, "graph", "show a graph."), clEnumValN(PGOVCT_Text, "text", "show in text."))   
)
static

Referenced by annotateAllFunctions().

◆ PGOWarnMissing

cl::opt< bool > PGOWarnMissing("pgo-warn-missing-function", cl::init(false), cl::Hidden, cl::desc("Use this option to turn on/off " "warnings about missing profile data for " "functions.")) ( "pgo-warn-missing-function"  ,
cl::init(false)  ,
cl::Hidden  ,
cl::desc("Use this option to turn on/off " "warnings about missing profile data for " "functions.")   
)
static

◆ ValueProfKindDescr

const char* ValueProfKindDescr[]
static
Initial value:
= {
#define VALUE_PROF_KIND(Enumerator, Value, Descr)
}

Definition at line 382 of file PGOInstrumentation.cpp.

Referenced by instrumentOneFunc().