22template <
typename CallGraphType>
23void SyntheticCountsUtils<CallGraphType>::propagateFromSCC(
24 const SccTy &SCC, GetProfCountTy GetProfCount, AddCountTy AddCount) {
31 for (
const auto &
Node : SCCNodes) {
33 if (SCCNodes.count(CGT::edge_dest(
E)))
49 for (
auto &
E : SCCEdges) {
50 auto OptProfCount = GetProfCount(
E.first,
E.second);
53 auto Callee = CGT::edge_dest(
E.second);
54 AdditionalCounts[
Callee] += *OptProfCount;
58 for (
auto &Entry : AdditionalCounts)
59 AddCount(Entry.first, Entry.second);
62 for (
auto &
E : NonSCCEdges) {
63 auto OptProfCount = GetProfCount(
E.first,
E.second);
66 auto Callee = CGT::edge_dest(
E.second);
67 AddCount(Callee, *OptProfCount);
79template <
typename CallGraphType>
83 std::vector<SccTy> SCCs;
93 propagateFromSCC(SCC, GetProfCount, AddCount);
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file provides interfaces used to build and manipulate a call graph, which is a very useful tool ...
This file defines the DenseSet and SmallDenseSet classes.
ModuleSummaryIndex.h This file contains the declarations the classes that hold the module index and s...
This builds on the llvm/ADT/GraphTraits.h file to find the strongly connected components (SCCs) of a ...
Implements a dense probed hash-table based set.
reference emplace_back(ArgTypes &&... Args)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Class with methods to propagate synthetic entry counts.
function_ref< std::optional< Scaled64 >(NodeRef, EdgeRef)> GetProfCountTy
function_ref< void(NodeRef, Scaled64)> AddCountTy
static void propagate(const CallGraphType &CG, GetProfCountTy GetProfCount, AddCountTy AddCount)
Propgate synthetic entry counts on a callgraph CG.
This is an optimization pass for GlobalISel generic memory operations.
constexpr from_range_t from_range
scc_iterator< T > scc_begin(const T &G)
Construct the begin iterator for a deduced graph type T.
auto reverse(ContainerTy &&C)
iterator_range< typename GraphTraits< GraphType >::ChildEdgeIteratorType > children_edges(const typename GraphTraits< GraphType >::NodeRef &G)