47 #define DEBUG_TYPE "synthetic-counts-propagation" 53 cl::desc(
"Initial value of synthetic entry count."));
58 cl::desc(
"Initial synthetic entry count for inline functions."));
63 cl::desc(
"Initial synthetic entry count for cold functions."));
68 auto MayHaveIndirectCalls = [](
Function &
F) {
69 for (
auto *U :
F.users()) {
70 if (!isa<CallInst>(U) && !isa<InvokeInst>(U))
78 if (
F.isDeclaration())
85 }
else if (
F.hasLocalLinkage() && !MayHaveIndirectCalls(
F)) {
94 SetCount(&
F, InitialCount);
114 assert(isa<Instruction>(Edge.first));
115 CallSite CS(cast<Instruction>(Edge.first));
123 Scaled64 BBCount(
BFI.getBlockFreq(CSBB).getFrequency(), 0);
124 BBCount /= EntryFreq;
125 BBCount *= Counts[Caller];
141 for (
auto Entry : Counts) {
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.
A Module instance is used to store all the information related to an LLVM module. ...
An efficient, type-erasing, non-owning reference to a callable.
cl::opt< int > InitialSyntheticCount("initial-synthetic-count", cl::Hidden, cl::init(10), cl::ZeroOrMore, cl::desc("Initial value of synthetic entry count."))
Initial synthetic count assigned to functions.
A node in the call graph for a module.
static cl::opt< int > ColdSyntheticCount("cold-synthetic-count", cl::Hidden, cl::init(5), cl::ZeroOrMore, cl::desc("Initial synthetic entry count for cold functions."))
Initial synthetic count assigned to cold functions.
InstrTy * getInstruction() const
This file provides interfaces used to build and manipulate a call graph, which is a very useful tool ...
initializer< Ty > init(const Ty &Val)
A set of analyses that are preserved following a run of a transformation pass.
LLVM Basic Block Representation.
static void propagate(const CallGraphType &CG, GetProfCountTy GetProfCount, AddCountTy AddCount)
Propgate synthetic entry counts on a callgraph CG.
Function::ProfileCount ProfileCount
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Class to represent profile counts.
Function * getFunction() const
Returns the function that this call graph node represents.
Analysis pass which computes BlockFrequencyInfo.
Module.h This file contains the declarations for the Module class.
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM)
The basic data container for the call graph of a Module of IR.
FunTy * getCaller() const
Return the caller function for this call site.
std::pair< WeakTrackingVH, CallGraphNode * > CallRecord
A pair of the calling instruction (a call or invoke) and the call graph node being called...
static void initializeCounts(Module &M, function_ref< void(Function *, uint64_t)> SetCount)
static cl::opt< int > InlineSyntheticCount("inline-synthetic-count", cl::Hidden, cl::init(15), cl::ZeroOrMore, cl::desc("Initial synthetic entry count for inline functions."))
Initial synthetic count assigned to inline functions.
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ScaledNumber< uint64_t > Scaled64
A container for analyses that lazily runs them and caches their results.
const BasicBlock * getParent() const
An analysis over an "outer" IR unit that provides access to an analysis manager over an "inner" IR un...