33 Function *CalledF, uint64_t NewCount) {
36 uint64_t &Count = Counts[std::make_pair(F, CalledF)];
40 (void)(
bool)Symtab.
create(M);
42 if (F.isDeclaration())
45 if (
BFI.getEntryFreq() == 0)
57 InstrProfValueData ValueData[8];
61 IPVK_IndirectCallTarget, 8, ValueData,
62 ActualNumValueData, TotalC))
66 UpdateCounts(TTI, &F, Symtab.
getFunction(VD.Value), VD.Count);
75 addModuleFlags(M, Counts);
80 void CGProfilePass::addModuleFlags(
82 MapVector<std::pair<Function *, Function *>, uint64_t> &Counts)
const {
88 std::vector<Metadata *> Nodes;
90 for (
auto E : Counts) {
A symbol table used for function PGO name look-up with keys (such as pointers, md5hash values) to the...
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
This class represents lattice values for constants.
ConstantAsMetadata * createConstant(Constant *C)
Return the given constant as metadata.
A Module instance is used to store all the information related to an LLVM module. ...
Function * getFunction(uint64_t FuncMD5Hash)
Return function from the name's md5 hash. Return nullptr if not found.
Analysis pass providing the TargetTransformInfo.
This class implements a map that also provides access to all stored values in a deterministic order...
static IntegerType * getInt64Ty(LLVMContext &C)
bool isIndirectCall() const
Return true if the callsite is an indirect call.
std::enable_if< std::is_unsigned< T >::value, T >::type SaturatingAdd(T X, T Y, bool *ResultOverflowed=nullptr)
Add two unsigned integers, X and Y, of type T.
Appends the two values, which are required to be metadata nodes.
LLVMContext & getContext() const
Get the global data context.
InstrTy * getInstruction() const
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata *> MDs)
bool getValueProfDataFromInst(const Instruction &Inst, InstrProfValueKind ValueKind, uint32_t MaxNumValueData, InstrProfValueData ValueData[], uint32_t &ActualNumValueData, uint64_t &TotalC)
Extract the value profile data from Inst which is annotated with value profile meta data...
A set of analyses that are preserved following a run of a transformation pass.
This is an important class for using LLVM in a threaded context.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
void addModuleFlag(ModFlagBehavior Behavior, StringRef Key, Metadata *Val)
Add a module-level flag to the module-level flags metadata.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
Error create(object::SectionRef &Section)
Create InstrProfSymtab from an object file section which contains function PGO names.
Analysis pass which computes BlockFrequencyInfo.
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
FunTy * getCalledFunction() const
Return the function being called if this is a direct call, otherwise return null (if it's an indirect...
This file provides the interface for LLVM's Call Graph Profile pass.
A container for analyses that lazily runs them and caches their results.
This header defines various interfaces for pass management in LLVM.
An analysis over an "outer" IR unit that provides access to an analysis manager over an "inner" IR un...