LLVM  14.0.0git
BlockFrequencyInfo.cpp
Go to the documentation of this file.
1 //===- BlockFrequencyInfo.cpp - Block Frequency Analysis ------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Loops should be simplified before this analysis.
10 //
11 //===----------------------------------------------------------------------===//
12 
14 #include "llvm/ADT/APInt.h"
15 #include "llvm/ADT/None.h"
16 #include "llvm/ADT/iterator.h"
19 #include "llvm/Analysis/LoopInfo.h"
20 #include "llvm/IR/CFG.h"
21 #include "llvm/IR/Function.h"
22 #include "llvm/IR/PassManager.h"
23 #include "llvm/InitializePasses.h"
24 #include "llvm/Pass.h"
28 #include <algorithm>
29 #include <cassert>
30 #include <string>
31 
32 using namespace llvm;
33 
34 #define DEBUG_TYPE "block-freq"
35 
37  "view-block-freq-propagation-dags", cl::Hidden,
38  cl::desc("Pop up a window to show a dag displaying how block "
39  "frequencies propagation through the CFG."),
40  cl::values(clEnumValN(GVDT_None, "none", "do not display graphs."),
41  clEnumValN(GVDT_Fraction, "fraction",
42  "display a graph using the "
43  "fractional block frequency representation."),
44  clEnumValN(GVDT_Integer, "integer",
45  "display a graph using the raw "
46  "integer fractional block frequency representation."),
47  clEnumValN(GVDT_Count, "count", "display a graph using the real "
48  "profile count if available.")));
49 
50 namespace llvm {
52  ViewBlockFreqFuncName("view-bfi-func-name", cl::Hidden,
53  cl::desc("The option to specify "
54  "the name of the function "
55  "whose CFG will be displayed."));
56 
58  ViewHotFreqPercent("view-hot-freq-percent", cl::init(10), cl::Hidden,
59  cl::desc("An integer in percent used to specify "
60  "the hot blocks/edges to be displayed "
61  "in red: a block or edge whose frequency "
62  "is no less than the max frequency of the "
63  "function multiplied by this percent."));
64 
65 // Command line option to turn on CFG dot or text dump after profile annotation.
67  "pgo-view-counts", cl::Hidden,
68  cl::desc("A boolean option to show CFG dag or text with "
69  "block profile counts and branch probabilities "
70  "right after PGO profile annotation step. The "
71  "profile counts are computed using branch "
72  "probabilities from the runtime profile data and "
73  "block frequency propagation algorithm. To view "
74  "the raw counts from the profile, use option "
75  "-pgo-view-raw-counts instead. To limit graph "
76  "display to only one function, use filtering option "
77  "-view-bfi-func-name."),
78  cl::values(clEnumValN(PGOVCT_None, "none", "do not show."),
79  clEnumValN(PGOVCT_Graph, "graph", "show a graph."),
80  clEnumValN(PGOVCT_Text, "text", "show in text.")));
81 
83  "print-bfi", cl::init(false), cl::Hidden,
84  cl::desc("Print the block frequency info."));
85 
87  "print-bfi-func-name", cl::Hidden,
88  cl::desc("The option to specify the name of the function "
89  "whose block frequency info is printed."));
90 } // namespace llvm
91 
92 namespace llvm {
93 
94 static GVDAGType getGVDT() {
96  return GVDT_Count;
98 }
99 
100 template <>
102  using NodeRef = const BasicBlock *;
105 
107  return &G->getFunction()->front();
108  }
109 
111  return succ_begin(N);
112  }
113 
114  static ChildIteratorType child_end(const NodeRef N) { return succ_end(N); }
115 
117  return nodes_iterator(G->getFunction()->begin());
118  }
119 
121  return nodes_iterator(G->getFunction()->end());
122  }
123 };
124 
125 using BFIDOTGTraitsBase =
127 
128 template <>
130  explicit DOTGraphTraits(bool isSimple = false)
132 
133  std::string getNodeLabel(const BasicBlock *Node,
134  const BlockFrequencyInfo *Graph) {
135 
136  return BFIDOTGTraitsBase::getNodeLabel(Node, Graph, getGVDT());
137  }
138 
139  std::string getNodeAttributes(const BasicBlock *Node,
140  const BlockFrequencyInfo *Graph) {
141  return BFIDOTGTraitsBase::getNodeAttributes(Node, Graph,
143  }
144 
145  std::string getEdgeAttributes(const BasicBlock *Node, EdgeIter EI,
146  const BlockFrequencyInfo *BFI) {
147  return BFIDOTGTraitsBase::getEdgeAttributes(Node, EI, BFI, BFI->getBPI(),
149  }
150 };
151 
152 } // end namespace llvm
153 
155 
157  const BranchProbabilityInfo &BPI,
158  const LoopInfo &LI) {
159  calculate(F, BPI, LI);
160 }
161 
163  : BFI(std::move(Arg.BFI)) {}
164 
166  releaseMemory();
167  BFI = std::move(RHS.BFI);
168  return *this;
169 }
170 
171 // Explicitly define the default constructor otherwise it would be implicitly
172 // defined at the first ODR-use which is the BFI member in the
173 // LazyBlockFrequencyInfo header. The dtor needs the BlockFrequencyInfoImpl
174 // template instantiated which is not available in the header.
176 
179  // Check whether the analysis, all analyses on functions, or the function's
180  // CFG have been preserved.
181  auto PAC = PA.getChecker<BlockFrequencyAnalysis>();
182  return !(PAC.preserved() || PAC.preservedSet<AllAnalysesOn<Function>>() ||
183  PAC.preservedSet<CFGAnalyses>());
184 }
185 
187  const BranchProbabilityInfo &BPI,
188  const LoopInfo &LI) {
189  if (!BFI)
190  BFI.reset(new ImplType);
191  BFI->calculate(F, BPI, LI);
193  (ViewBlockFreqFuncName.empty() ||
194  F.getName().equals(ViewBlockFreqFuncName))) {
195  view();
196  }
197  if (PrintBlockFreq &&
198  (PrintBlockFreqFuncName.empty() ||
199  F.getName().equals(PrintBlockFreqFuncName))) {
200  print(dbgs());
201  }
202 }
203 
205  return BFI ? BFI->getBlockFreq(BB) : 0;
206 }
207 
210  bool AllowSynthetic) const {
211  if (!BFI)
212  return None;
213 
214  return BFI->getBlockProfileCount(*getFunction(), BB, AllowSynthetic);
215 }
216 
219  if (!BFI)
220  return None;
221  return BFI->getProfileCountFromFreq(*getFunction(), Freq);
222 }
223 
225  assert(BFI && "Expected analysis to be available");
226  return BFI->isIrrLoopHeader(BB);
227 }
228 
230  assert(BFI && "Expected analysis to be available");
231  BFI->setBlockFreq(BB, Freq);
232 }
233 
235  const BasicBlock *ReferenceBB, uint64_t Freq,
236  SmallPtrSetImpl<BasicBlock *> &BlocksToScale) {
237  assert(BFI && "Expected analysis to be available");
238  // Use 128 bits APInt to avoid overflow.
239  APInt NewFreq(128, Freq);
240  APInt OldFreq(128, BFI->getBlockFreq(ReferenceBB).getFrequency());
241  APInt BBFreq(128, 0);
242  for (auto *BB : BlocksToScale) {
243  BBFreq = BFI->getBlockFreq(BB).getFrequency();
244  // Multiply first by NewFreq and then divide by OldFreq
245  // to minimize loss of precision.
246  BBFreq *= NewFreq;
247  // udiv is an expensive operation in the general case. If this ends up being
248  // a hot spot, one of the options proposed in
249  // https://reviews.llvm.org/D28535#650071 could be used to avoid this.
250  BBFreq = BBFreq.udiv(OldFreq);
251  BFI->setBlockFreq(BB, BBFreq.getLimitedValue());
252  }
253  BFI->setBlockFreq(ReferenceBB, Freq);
254 }
255 
256 /// Pop up a ghostview window with the current block frequency propagation
257 /// rendered using dot.
259  ViewGraph(const_cast<BlockFrequencyInfo *>(this), title);
260 }
261 
263  return BFI ? BFI->getFunction() : nullptr;
264 }
265 
267  return BFI ? &BFI->getBPI() : nullptr;
268 }
269 
271 printBlockFreq(raw_ostream &OS, const BlockFrequency Freq) const {
272  return BFI ? BFI->printBlockFreq(OS, Freq) : OS;
273 }
274 
275 raw_ostream &
277  const BasicBlock *BB) const {
278  return BFI ? BFI->printBlockFreq(OS, BB) : OS;
279 }
280 
282  return BFI ? BFI->getEntryFreq() : 0;
283 }
284 
286 
288  if (BFI)
289  BFI->print(OS);
290 }
291 
293  if (BFI)
294  BFI->verifyMatch(*Other.BFI);
295 }
296 
298  "Block Frequency Analysis", true, true)
302  "Block Frequency Analysis", true, true)
303 
305 
307  : FunctionPass(ID) {
309 }
310 
312 
314  const Module *) const {
315  BFI.print(OS);
316 }
317 
321  AU.setPreservesAll();
322 }
323 
325 
327  BranchProbabilityInfo &BPI =
328  getAnalysis<BranchProbabilityInfoWrapperPass>().getBPI();
329  LoopInfo &LI = getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
330  BFI.calculate(F, BPI, LI);
331  return false;
332 }
333 
338  BFI.calculate(F, AM.getResult<BranchProbabilityAnalysis>(F),
339  AM.getResult<LoopAnalysis>(F));
340  return BFI;
341 }
342 
345  OS << "Printing analysis results of BFI for function "
346  << "'" << F.getName() << "':"
347  << "\n";
349  return PreservedAnalyses::all();
350 }
llvm::SuccIterator
Definition: CFG.h:139
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:155
block
we get the following basic block
Definition: README_ALTIVEC.txt:95
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::ViewHotFreqPercent
cl::opt< unsigned > ViewHotFreqPercent("view-hot-freq-percent", cl::init(10), cl::Hidden, cl::desc("An integer in percent used to specify " "the hot blocks/edges to be displayed " "in red: a block or edge whose frequency " "is no less than the max frequency of the " "function multiplied by this percent."))
Definition: MachineBlockFrequencyInfo.cpp:70
llvm::DOTGraphTraits< BlockFrequencyInfo * >::getNodeLabel
std::string getNodeLabel(const BasicBlock *Node, const BlockFrequencyInfo *Graph)
Definition: BlockFrequencyInfo.cpp:133
print
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
Definition: ArchiveWriter.cpp:147
llvm::BlockFrequencyInfo::print
void print(raw_ostream &OS) const
Definition: BlockFrequencyInfo.cpp:287
llvm::AnalysisManager::getResult
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Definition: PassManager.h:783
llvm::succ_end
Interval::succ_iterator succ_end(Interval *I)
Definition: Interval.h:102
llvm::Function
Definition: Function.h:62
Pass.h
llvm::BlockFrequencyInfoWrapperPass
Legacy analysis pass which computes BlockFrequencyInfo.
Definition: BlockFrequencyInfo.h:138
llvm::GraphTraits< BlockFrequencyInfo * >::child_begin
static ChildIteratorType child_begin(const NodeRef N)
Definition: BlockFrequencyInfo.cpp:110
true
block Block Frequency true
Definition: BlockFrequencyInfo.cpp:302
llvm::AllAnalysesOn
This templated class represents "all analyses that operate over <a particular IR unit>" (e....
Definition: PassManager.h:93
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:143
APInt.h
llvm::BlockFrequencyInfo::view
void view(StringRef="BlockFrequencyDAGs") const
Pop up a ghostview window with the current block frequency propagation rendered using dot.
Definition: BlockFrequencyInfo.cpp:258
Analysis
block Block Frequency Analysis
Definition: BlockFrequencyInfo.cpp:302
llvm::GraphTraits< BlockFrequencyInfo * >::getEntryNode
static NodeRef getEntryNode(const BlockFrequencyInfo *G)
Definition: BlockFrequencyInfo.cpp:106
llvm::LoopInfoWrapperPass
The legacy pass manager's analysis pass to compute loop information.
Definition: LoopInfo.h:1268
llvm::BlockFrequencyInfoWrapperPass::~BlockFrequencyInfoWrapperPass
~BlockFrequencyInfoWrapperPass() override
llvm::Optional< uint64_t >
llvm::BlockFrequencyInfoWrapperPass::runOnFunction
bool runOnFunction(Function &F) override
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.
Definition: BlockFrequencyInfo.cpp:326
llvm::ViewGraph
void ViewGraph(const GraphType &G, const Twine &Name, bool ShortNames=false, const Twine &Title="", GraphProgram::Name Program=GraphProgram::DOT)
ViewGraph - Emit a dot graph, run 'dot', run gv on the postscript file, then cleanup.
Definition: GraphWriter.h:430
llvm::PGOVCT_Text
@ PGOVCT_Text
Definition: BlockFrequencyInfo.h:33
freq
block freq
Definition: BlockFrequencyInfo.cpp:301
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:58
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163
Arg
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
Definition: AMDGPULibCalls.cpp:206
llvm::BFIDOTGraphTraitsBase::getNodeLabel
std::string getNodeLabel(NodeRef Node, const BlockFrequencyInfoT *Graph, GVDAGType GType, int layout_order=-1)
Definition: BlockFrequencyInfoImpl.h:1858
CommandLine.h
llvm::BlockFrequencyInfo::getEntryFreq
uint64_t getEntryFreq() const
Definition: BlockFrequencyInfo.cpp:281
llvm::PGOVCT_Graph
@ PGOVCT_Graph
Definition: BlockFrequencyInfo.h:33
llvm::BranchProbabilityAnalysis
Analysis pass which computes BranchProbabilityInfo.
Definition: BranchProbabilityInfo.h:414
llvm::GVDT_Fraction
@ GVDT_Fraction
Definition: BlockFrequencyInfoImpl.h:1810
llvm::BlockFrequencyInfo
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
Definition: BlockFrequencyInfo.h:37
BlockFrequencyInfoImpl.h
llvm::PassRegistry::getPassRegistry
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Definition: PassRegistry.cpp:31
llvm::BranchProbabilityInfoWrapperPass
Legacy analysis pass which computes BranchProbabilityInfo.
Definition: BranchProbabilityInfo.h:440
llvm::BlockFrequencyInfo::getProfileCountFromFreq
Optional< uint64_t > getProfileCountFromFreq(uint64_t Freq) const
Returns the estimated profile count of Freq.
Definition: BlockFrequencyInfo.cpp:218
llvm::BranchProbabilityInfo
Analysis providing branch probability information.
Definition: BranchProbabilityInfo.h:115
llvm::AnalysisUsage
Represent the analysis usage information of a pass.
Definition: PassAnalysisSupport.h:47
llvm::AMDGPU::PALMD::Key
Key
PAL metadata keys.
Definition: AMDGPUMetadata.h:481
llvm::APInt::getLimitedValue
uint64_t getLimitedValue(uint64_t Limit=UINT64_MAX) const
If this value is smaller than the specified limit, return it, otherwise return the limit value.
Definition: APInt.h:456
llvm::BlockFrequencyInfo::setBlockFreq
void setBlockFreq(const BasicBlock *BB, uint64_t Freq)
Definition: BlockFrequencyInfo.cpp:229
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::PrintBlockFreqFuncName
cl::opt< std::string > PrintBlockFreqFuncName("print-bfi-func-name", cl::Hidden, cl::desc("The option to specify the name of the function " "whose block frequency info is printed."))
Definition: MachineBlockFrequencyInfo.cpp:78
llvm::BFIDOTGraphTraitsBase::getEdgeAttributes
std::string getEdgeAttributes(NodeRef Node, EdgeIter EI, const BlockFrequencyInfoT *BFI, const BranchProbabilityInfoT *BPI, unsigned HotPercentThreshold=0)
Definition: BlockFrequencyInfoImpl.h:1889
llvm::BlockFrequencyInfo::releaseMemory
void releaseMemory()
Definition: BlockFrequencyInfo.cpp:285
llvm::AnalysisManager::Invalidator
API to communicate dependencies between analyses during invalidation.
Definition: PassManager.h:670
llvm::BlockFrequencyInfo::printBlockFreq
raw_ostream & printBlockFreq(raw_ostream &OS, const BlockFrequency Freq) const
Definition: BlockFrequencyInfo.cpp:271
llvm::BlockFrequencyAnalysis
Analysis pass which computes BlockFrequencyInfo.
Definition: BlockFrequencyInfo.h:112
llvm::None
const NoneType None
Definition: None.h:23
INITIALIZE_PASS_END
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
Definition: PassSupport.h:58
CFG.h
LoopInfo.h
llvm::DOTGraphTraits
DOTGraphTraits - Template class that can be specialized to customize how graphs are converted to 'dot...
Definition: DOTGraphTraits.h:166
G
const DataFlowGraph & G
Definition: RDFGraph.cpp:202
llvm::pointer_iterator
Definition: iterator.h:344
llvm::cl::opt
Definition: CommandLine.h:1432
llvm::BlockFrequency
Definition: BlockFrequency.h:24
llvm::cl::values
ValuesClass values(OptsTy... Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
Definition: CommandLine.h:697
BranchProbabilityInfo.h
llvm::PGOViewCounts
cl::opt< PGOViewCountsType > PGOViewCounts("pgo-view-counts", cl::Hidden, cl::desc("A boolean option to show CFG dag or text with " "block profile counts and branch probabilities " "right after PGO profile annotation step. The " "profile counts are computed using branch " "probabilities from the runtime profile data and " "block frequency propagation algorithm. To view " "the raw counts from the profile, use option " "-pgo-view-raw-counts instead. 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.")))
Definition: PGOInstrumentation.cpp:289
uint64_t
INITIALIZE_PASS_BEGIN
INITIALIZE_PASS_BEGIN(BlockFrequencyInfoWrapperPass, "block-freq", "Block Frequency Analysis", true, true) INITIALIZE_PASS_END(BlockFrequencyInfoWrapperPass
INITIALIZE_PASS_DEPENDENCY
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
llvm::BlockFrequencyInfo::~BlockFrequencyInfo
~BlockFrequencyInfo()
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::AnalysisKey
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: PassManager.h:72
iterator.h
ViewBlockFreqPropagationDAG
static cl::opt< GVDAGType > ViewBlockFreqPropagationDAG("view-block-freq-propagation-dags", cl::Hidden, cl::desc("Pop up a window to show a dag displaying how block " "frequencies propagation through the CFG."), cl::values(clEnumValN(GVDT_None, "none", "do not display graphs."), clEnumValN(GVDT_Fraction, "fraction", "display a graph using the " "fractional block frequency representation."), clEnumValN(GVDT_Integer, "integer", "display a graph using the raw " "integer fractional block frequency representation."), clEnumValN(GVDT_Count, "count", "display a graph using the real " "profile count if available.")))
llvm::PrintBlockFreq
static cl::opt< bool > PrintBlockFreq("print-bfi", cl::init(false), cl::Hidden, cl::desc("Print the block frequency info."))
llvm::succ_begin
Interval::succ_iterator succ_begin(Interval *I)
succ_begin/succ_end - define methods so that Intervals may be used just like BasicBlocks can with the...
Definition: Interval.h:99
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:441
llvm::BlockFrequencyInfo::operator=
BlockFrequencyInfo & operator=(const BlockFrequencyInfo &)=delete
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::move
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1658
llvm::PGOVCT_None
@ PGOVCT_None
Definition: BlockFrequencyInfo.h:33
llvm::BFIDOTGraphTraitsBase::EdgeIter
typename GTraits::ChildIteratorType EdgeIter
Definition: BlockFrequencyInfoImpl.h:1816
llvm::BlockFrequencyInfo::isIrrLoopHeader
bool isIrrLoopHeader(const BasicBlock *BB)
Returns true if BB is an irreducible loop header block.
Definition: BlockFrequencyInfo.cpp:224
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::GVDT_Integer
@ GVDT_Integer
Definition: BlockFrequencyInfoImpl.h:1810
llvm::APInt
Class for arbitrary precision integers.
Definition: APInt.h:75
llvm::BFIDOTGraphTraitsBase::getNodeAttributes
std::string getNodeAttributes(NodeRef Node, const BlockFrequencyInfoT *Graph, unsigned HotPercentThreshold=0)
Definition: BlockFrequencyInfoImpl.h:1828
llvm::BlockFrequencyInfo::calculate
void calculate(const Function &F, const BranchProbabilityInfo &BPI, const LoopInfo &LI)
calculate - compute block frequency info for the given function.
Definition: BlockFrequencyInfo.cpp:186
llvm::LoopInfo
Definition: LoopInfo.h:1083
None.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::CFGAnalyses
Represents analyses that only rely on functions' control flow.
Definition: PassManager.h:116
llvm::GraphTraits< BlockFrequencyInfo * >::child_end
static ChildIteratorType child_end(const NodeRef N)
Definition: BlockFrequencyInfo.cpp:114
clEnumValN
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)
Definition: CommandLine.h:672
BlockFrequencyInfo.h
llvm::AMDGPUISD::BFI
@ BFI
Definition: AMDGPUISelLowering.h:431
llvm::APInt::udiv
APInt udiv(const APInt &RHS) const
Unsigned division operation.
Definition: APInt.cpp:1565
llvm::BlockFrequencyInfo::invalidate
bool invalidate(Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &)
Handle invalidation explicitly.
Definition: BlockFrequencyInfo.cpp:177
llvm::BlockFrequencyInfo::setBlockFreqAndScale
void setBlockFreqAndScale(const BasicBlock *ReferenceBB, uint64_t Freq, SmallPtrSetImpl< BasicBlock * > &BlocksToScale)
Set the frequency of ReferenceBB to Freq and scale the frequencies of the blocks in BlocksToScale suc...
Definition: BlockFrequencyInfo.cpp:234
llvm::DOTGraphTraits< BlockFrequencyInfo * >::getNodeAttributes
std::string getNodeAttributes(const BasicBlock *Node, const BlockFrequencyInfo *Graph)
Definition: BlockFrequencyInfo.cpp:139
GraphWriter.h
std
Definition: BitVector.h:838
llvm::AnalysisUsage::setPreservesAll
void setPreservesAll()
Set by analyses that do not transform their input at all.
Definition: PassAnalysisSupport.h:130
llvm::PreservedAnalyses::all
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition: PassManager.h:161
llvm::DOTGraphTraits< BlockFrequencyInfo * >::DOTGraphTraits
DOTGraphTraits(bool isSimple=false)
Definition: BlockFrequencyInfo.cpp:130
Function.h
llvm::BlockFrequencyAnalysis::run
Result run(Function &F, FunctionAnalysisManager &AM)
Run the analysis pass over a function and produce BFI.
Definition: BlockFrequencyInfo.cpp:335
llvm::GraphTraits< BlockFrequencyInfo * >::nodes_begin
static nodes_iterator nodes_begin(const BlockFrequencyInfo *G)
Definition: BlockFrequencyInfo.cpp:116
llvm::BFIDOTGraphTraitsBase
Definition: BlockFrequencyInfoImpl.h:1813
PassManager.h
llvm::DOTGraphTraits< BlockFrequencyInfo * >::getEdgeAttributes
std::string getEdgeAttributes(const BasicBlock *Node, EdgeIter EI, const BlockFrequencyInfo *BFI)
Definition: BlockFrequencyInfo.cpp:145
llvm::BlockFrequencyInfo::getBPI
const BranchProbabilityInfo * getBPI() const
Definition: BlockFrequencyInfo.cpp:266
llvm::BlockFrequencyInfoWrapperPass::print
void print(raw_ostream &OS, const Module *M) const override
print - Print out the internal state of the pass.
Definition: BlockFrequencyInfo.cpp:313
isSimple
static bool isSimple(Instruction *I)
Definition: SLPVectorizer.cpp:593
llvm::BlockFrequencyInfo::getBlockFreq
BlockFrequency getBlockFreq(const BasicBlock *BB) const
getblockFreq - Return block frequency.
Definition: BlockFrequencyInfo.cpp:204
llvm::GVDT_Count
@ GVDT_Count
Definition: BlockFrequencyInfoImpl.h:1810
llvm::getGVDT
static GVDAGType getGVDT()
Definition: BlockFrequencyInfo.cpp:94
llvm::BlockFrequencyInfo::getFunction
const Function * getFunction() const
Definition: BlockFrequencyInfo.cpp:262
llvm::GVDT_None
@ GVDT_None
Definition: BlockFrequencyInfoImpl.h:1810
llvm::BlockFrequencyInfo::getBlockProfileCount
Optional< uint64_t > getBlockProfileCount(const BasicBlock *BB, bool AllowSynthetic=false) const
Returns the estimated profile count of BB.
Definition: BlockFrequencyInfo.cpp:209
llvm::BlockFrequencyInfoWrapperPass::releaseMemory
void releaseMemory() override
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
Definition: BlockFrequencyInfo.cpp:324
N
#define N
llvm::BlockFrequencyInfo::BlockFrequencyInfo
BlockFrequencyInfo()
llvm::BlockFrequencyInfo::verifyMatch
void verifyMatch(BlockFrequencyInfo &Other) const
Definition: BlockFrequencyInfo.cpp:292
llvm::BlockFrequencyInfoImpl
Shared implementation for block frequency analysis.
Definition: BlockFrequencyInfo.h:31
llvm::SmallPtrSetImpl
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
Definition: SmallPtrSet.h:343
llvm::PreservedAnalyses::getChecker
PreservedAnalysisChecker getChecker() const
Build a checker for this PreservedAnalyses and the specified analysis type.
Definition: PassManager.h:313
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:44
llvm::FunctionPass
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:298
llvm::GraphTraits< BlockFrequencyInfo * >::nodes_end
static nodes_iterator nodes_end(const BlockFrequencyInfo *G)
Definition: BlockFrequencyInfo.cpp:120
llvm::initializeBlockFrequencyInfoWrapperPassPass
void initializeBlockFrequencyInfoWrapperPassPass(PassRegistry &)
BB
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
Definition: README.txt:39
llvm::ViewBlockFreqFuncName
cl::opt< std::string > ViewBlockFreqFuncName("view-bfi-func-name", cl::Hidden, cl::desc("The option to specify " "the name of the function " "whose CFG will be displayed."))
Definition: MachineBlockFrequencyInfo.cpp:66
llvm::AnalysisUsage::addRequired
AnalysisUsage & addRequired()
Definition: PassAnalysisSupport.h:75
llvm::GraphTraits
Definition: GraphTraits.h:35
llvm::const_succ_iterator
SuccIterator< const Instruction, const BasicBlock > const_succ_iterator
Definition: CFG.h:244
llvm::cl::desc
Definition: CommandLine.h:412
raw_ostream.h
llvm::BlockFrequencyPrinterPass::run
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Definition: BlockFrequencyInfo.cpp:344
llvm::BlockFrequencyInfoWrapperPass::getAnalysisUsage
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
Definition: BlockFrequencyInfo.cpp:318
InitializePasses.h
llvm::LoopAnalysis
Analysis pass that exposes the LoopInfo for a function.
Definition: LoopInfo.h:1243
Other
Optional< std::vector< StOtherPiece > > Other
Definition: ELFYAML.cpp:1195
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:38
llvm::GVDAGType
GVDAGType
Definition: BlockFrequencyInfoImpl.h:1810