27 template <
typename CallGraphType>
29 const SccTy &SCC, GetProfCountTy GetProfCount, AddCountTy AddCount) {
34 for (
auto &Node : SCC)
39 for (
const auto &Node : SCCNodes) {
40 for (
auto &
E : children_edges<CallGraphType>(Node)) {
41 if (SCCNodes.count(CGT::edge_dest(
E)))
57 for (
auto &
E : SCCEdges) {
58 auto OptProfCount = GetProfCount(
E.first,
E.second);
61 auto Callee = CGT::edge_dest(
E.second);
62 AdditionalCounts[
Callee] += OptProfCount.getValue();
66 for (
auto &Entry : AdditionalCounts)
67 AddCount(Entry.first, Entry.second);
70 for (
auto &
E : NonSCCEdges) {
71 auto OptProfCount = GetProfCount(
E.first,
E.second);
74 auto Callee = CGT::edge_dest(
E.second);
75 AddCount(Callee, OptProfCount.getValue());
87 template <
typename CallGraphType>
91 std::vector<SccTy> SCCs;
100 for (
auto &SCC :
reverse(SCCs))
101 propagateFromSCC(SCC, GetProfCount, AddCount);
This builds on the llvm/ADT/GraphTraits.h file to find the strongly connected components (SCCs) of a ...
This class represents lattice values for constants.
Implements a dense probed hash-table based set.
An efficient, type-erasing, non-owning reference to a callable.
scc_iterator< T > scc_begin(const T &G)
Construct the begin iterator for a deduced graph type T.
auto reverse(ContainerTy &&C, typename std::enable_if< has_rbegin< ContainerTy >::value >::type *=nullptr) -> decltype(make_range(C.rbegin(), C.rend()))
This file provides interfaces used to build and manipulate a call graph, which is a very useful tool ...
amdgpu Simplify well known AMD library false Value * Callee
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static void propagate(const CallGraphType &CG, GetProfCountTy GetProfCount, AddCountTy AddCount)
Propgate synthetic entry counts on a callgraph CG.
std::pair< iterator, bool > insert(const ValueT &V)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
void emplace_back(ArgTypes &&... Args)
ModuleSummaryIndex.h This file contains the declarations the classes that hold the module index and s...
Class with methods to propagate synthetic entry counts.