LLVM 24.0.0git
FunctionPropertiesAnalysis.cpp
Go to the documentation of this file.
1//===- FunctionPropertiesAnalysis.cpp - Function Properties 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// This file defines the FunctionPropertiesInfo and FunctionPropertiesAnalysis
10// classes used to extract function properties.
11//
12//===----------------------------------------------------------------------===//
13
15#include "AnalysisOptions.h"
16#include "llvm/ADT/STLExtras.h"
17#include "llvm/ADT/SetVector.h"
18#include "llvm/ADT/Statistic.h"
20#include "llvm/IR/CFG.h"
21#include "llvm/IR/Constants.h"
22#include "llvm/IR/Dominators.h"
27#include <deque>
28
29using namespace llvm;
30
31#define DEBUG_TYPE "func-properties-stats"
32
33#define FUNCTION_PROPERTY(Name, Description) \
34 STATISTIC(Num##Name, Description); \
35 STATISTIC(Num##Name##PreOptimization, Description " (before " \
36 "optimizations)");
37#define DETAILED_FUNCTION_PROPERTY(Name, Description) \
38 STATISTIC(Num##Name, Description); \
39 STATISTIC(Num##Name##PreOptimization, Description " (before " \
40 "optimizations)");
41#include "llvm/IR/FunctionProperties.def"
42
43namespace llvm {
45 "enable-detailed-function-properties", cl::Hidden, cl::init(false),
46 cl::desc("Whether or not to compute detailed function properties."));
47} // namespace llvm
48
49namespace {
50int64_t getNumBlocksFromCond(const BasicBlock &BB) {
51 int64_t Ret = 0;
52 if (const auto *BI = dyn_cast<CondBrInst>(BB.getTerminator())) {
53 Ret += BI->getNumSuccessors();
54 } else if (const auto *SI = dyn_cast<SwitchInst>(BB.getTerminator())) {
55 Ret += (SI->getNumCases() + (nullptr != SI->getDefaultDest()));
56 }
57 return Ret;
58}
59
60int64_t getUses(const Function &F) {
61 return ((!F.hasLocalLinkage()) ? 1 : 0) + F.getNumUses();
62}
63} // namespace
64
65void FunctionPropertiesInfo::reIncludeBB(const BasicBlock &BB) {
66 updateForBB(BB, +1);
67}
68
69void FunctionPropertiesInfo::updateForBB(const BasicBlock &BB,
70 int64_t Direction) {
71 assert(Direction == 1 || Direction == -1);
74 (Direction * getNumBlocksFromCond(BB));
75 for (const auto &I : BB) {
76 if (auto *CS = dyn_cast<CallBase>(&I)) {
77 const auto *Callee = CS->getCalledFunction();
78 if (Callee && !Callee->isIntrinsic() && !Callee->isDeclaration())
80 }
81 if (I.getOpcode() == Instruction::Load) {
83 } else if (I.getOpcode() == Instruction::Store) {
85 }
86 }
87 TotalInstructionCount += Direction * BB.size();
88
90 const AnalysisOptions &Opts = getAnalysisOptions(BB.getContext());
91 unsigned SuccessorCount = succ_size(&BB);
92 if (SuccessorCount == 1)
94 else if (SuccessorCount == 2)
96 else if (SuccessorCount > 2)
98
99 if (BB.hasNPredecessors(1))
101 else if (BB.hasNPredecessors(2))
103 else if (BB.hasNPredecessorsOrMore(3))
105
106 if (TotalInstructionCount > Opts.big_basic_block_instruction_threshold)
108 else if (TotalInstructionCount >
109 Opts.medium_basic_block_instruction_threshold)
111 else
113
114 // Calculate critical edges by looking through all successors of a basic
115 // block that has multiple successors and finding ones that have multiple
116 // predecessors, which represent critical edges.
117 if (SuccessorCount > 1) {
118 for (const auto *Successor : successors(&BB)) {
119 if (Successor->hasNPredecessorsOrMore(2))
121 }
122 }
123
124 ControlFlowEdgeCount += Direction * SuccessorCount;
125
126 const Instruction *TI = BB.getTerminator();
127 if (isa<UncondBrInst>(TI)) {
131 } else if (isa<CondBrInst>(TI)) {
135 } else if (const auto *SI = dyn_cast<SwitchInst>(TI)) {
137 SwitchSuccessorCount += Direction * SI->getNumSuccessors();
138 }
139
140 for (const Instruction &I : BB) {
141 if (I.isCast())
143
144 if (I.getType()->isFloatTy())
146 else if (I.getType()->isIntegerTy())
148
151
152 if (const auto *Call = dyn_cast<CallInst>(&I)) {
153 if (Call->doesNotReturn())
155
156 if (Call->isIndirectCall())
158 else
160
161 if (Call->getType()->isIntegerTy())
163 else if (Call->getType()->isFloatingPointTy())
165 else if (Call->getType()->isPointerTy())
167 else if (Call->getType()->isVectorTy()) {
172 else if (Call->getType()->getScalarType()->isPointerTy())
174 }
175
176 if (Call->arg_size() > Opts.call_with_many_arguments_threshold)
178
179 for (const auto &Arg : Call->args()) {
180 if (Arg->getType()->isPointerTy()) {
182 break;
183 }
184 }
185 }
186
187#define COUNT_OPERAND(OPTYPE) \
188 if (isa<OPTYPE>(Operand)) { \
189 OPTYPE##OperandCount += Direction; \
190 continue; \
191 }
192
193 for (unsigned int OperandIndex = 0; OperandIndex < I.getNumOperands();
194 ++OperandIndex) {
195 Value *Operand = I.getOperand(OperandIndex);
196 COUNT_OPERAND(GlobalValue)
197 COUNT_OPERAND(ConstantInt)
198 COUNT_OPERAND(ConstantFP)
199 COUNT_OPERAND(Constant)
200 COUNT_OPERAND(Instruction)
201 COUNT_OPERAND(BasicBlock)
202 COUNT_OPERAND(InlineAsm)
203 COUNT_OPERAND(Argument)
204
205 // We only get to this point if we haven't matched any of the other
206 // operand types.
208 }
209
210#undef CHECK_OPERAND
211 }
212 }
213
214 if (IR2VecVocab) {
215 // We instantiate the IR2Vec embedder each time, as having an unique
216 // pointer to the embedder as member of the class would make it
217 // non-copyable. Instantiating the embedder in itself is not costly.
219 *BB.getParent(), *IR2VecVocab);
220 if (!Embedder) {
221 BB.getContext().emitError("Error creating IR2Vec embeddings");
222 return;
223 }
224 const auto &BBEmbedding = Embedder->getBBVector(BB);
225 // Subtract BBEmbedding from Function embedding if the direction is -1,
226 // and add it if the direction is +1.
227 if (Direction == -1)
228 FunctionEmbedding -= BBEmbedding;
229 else
230 FunctionEmbedding += BBEmbedding;
231 }
232}
233
234void FunctionPropertiesInfo::updateAggregateStats(const Function &F,
235 const LoopInfo &LI) {
236
237 Uses = getUses(F);
239 MaxLoopDepth = 0;
240 std::deque<const Loop *> Worklist;
241 llvm::append_range(Worklist, LI);
242 while (!Worklist.empty()) {
243 const auto *L = Worklist.front();
245 std::max(MaxLoopDepth, static_cast<int64_t>(L->getLoopDepth()));
246 Worklist.pop_front();
247 llvm::append_range(Worklist, L->getSubLoops());
248 }
249}
250
253 // We use the cached result of the IR2VecVocabAnalysis run by
254 // InlineAdvisorAnalysis. If the IR2VecVocabAnalysis is not run, we don't
255 // use IR2Vec embeddings.
256 auto Vocabulary = FAM.getResult<ModuleAnalysisManagerFunctionProxy>(F)
257 .getCachedResult<IR2VecVocabAnalysis>(*F.getParent());
259 FAM.getResult<LoopAnalysis>(F), Vocabulary);
260}
261
263 const Function &F, const DominatorTree &DT, const LoopInfo &LI,
264 const ir2vec::Vocabulary *Vocabulary) {
265
267 if (Vocabulary && Vocabulary->isValid()) {
268 FPI.IR2VecVocab = Vocabulary;
269 FPI.FunctionEmbedding = ir2vec::Embedding(Vocabulary->getDimension(), 0.0);
270 }
271 for (const auto &BB : F)
272 if (DT.isReachableFromEntry(&BB))
273 FPI.reIncludeBB(BB);
274 FPI.updateAggregateStats(F, LI);
275 return FPI;
276}
277
279 const FunctionPropertiesInfo &FPI) const {
280 if (BasicBlockCount != FPI.BasicBlockCount ||
283 Uses != FPI.Uses ||
287 MaxLoopDepth != FPI.MaxLoopDepth ||
329 return false;
330 }
331 // Check the equality of the function embeddings. We don't check the equality
332 // of Vocabulary as it remains the same.
333 if (!FunctionEmbedding.approximatelyEquals(FPI.FunctionEmbedding))
334 return false;
335
336 return true;
337}
338
340#define FUNCTION_PROPERTY(Name, Description) OS << #Name ": " << Name << "\n";
341
342#define DETAILED_FUNCTION_PROPERTY(Name, Description) \
343 if (EnableDetailedFunctionProperties) { \
344 OS << #Name ": " << Name << "\n"; \
345 }
346
347#include "llvm/IR/FunctionProperties.def"
348
349#undef FUNCTION_PROPERTY
350#undef DETAILED_FUNCTION_PROPERTY
351
352 OS << "\n";
353}
354
356
361
364 OS << "Printing analysis results of CFA for function "
365 << "'" << F.getName() << "':"
366 << "\n";
368 return PreservedAnalyses::all();
369}
370
374 LLVM_DEBUG(dbgs() << "STATSCOUNT: running on function " << F.getName()
375 << "\n");
376 auto &AnalysisResults = FAM.getResult<FunctionPropertiesAnalysis>(F);
377 if (IsPreOptimization) {
378#define FUNCTION_PROPERTY(Name, Description) \
379 Num##Name##PreOptimization += AnalysisResults.Name;
380#define DETAILED_FUNCTION_PROPERTY(Name, Description) \
381 Num##Name##PreOptimization += AnalysisResults.Name;
382#include "llvm/IR/FunctionProperties.def"
383#undef FUNCTION_PROPERTY
384#undef DETAILED_FUNCTION_PROPERTY
385 } else {
386#define FUNCTION_PROPERTY(Name, Description) Num##Name += AnalysisResults.Name;
387#define DETAILED_FUNCTION_PROPERTY(Name, Description) \
388 Num##Name += AnalysisResults.Name;
389#include "llvm/IR/FunctionProperties.def"
390#undef FUNCTION_PROPERTY
391#undef DETAILED_FUNCTION_PROPERTY
392 }
393 return PreservedAnalyses::all();
394}
395
398 : FPI(FPI), CallSiteBB(*CB.getParent()), Caller(*CallSiteBB.getParent()) {
400 // For BBs that are likely to change, we subtract from feature totals their
401 // contribution. Some features, like max loop counts or depths, are left
402 // invalid, as they will be updated post-inlining.
403 SmallPtrSet<const BasicBlock *, 4> LikelyToChangeBBs;
404 // The CB BB will change - it'll either be split or the callee's body (single
405 // BB) will be pasted in.
406 LikelyToChangeBBs.insert(&CallSiteBB);
407
408 // The caller's entry BB may change due to new alloca instructions.
409 LikelyToChangeBBs.insert(&*Caller.begin());
410
411 // The users of the value returned by call instruction can change
412 // leading to the change in embeddings being computed, when used.
413 // We conservatively add the BBs with such uses to LikelyToChangeBBs.
414 for (const auto *User : CB.users())
415 CallUsers.insert(dyn_cast<Instruction>(User)->getParent());
416 // CallSiteBB can be removed from CallUsers if present, it's taken care
417 // separately.
418 CallUsers.erase(&CallSiteBB);
419 LikelyToChangeBBs.insert_range(CallUsers);
420
421 // The successors may become unreachable in the case of `invoke` inlining.
422 // We track successors separately, too, because they form a boundary, together
423 // with the CB BB ('Entry') between which the inlined callee will be pasted.
424 Successors.insert_range(successors(&CallSiteBB));
425
426 // the outcome of the inlining may be that some edges get lost (DCEd BBs
427 // because inlining brought some constant, for example). We don't know which
428 // edges will be removed, so we list all of them as potentially removable.
429 // Some BBs have (at this point) duplicate edges. Remove duplicates, otherwise
430 // the DT updater will not apply changes correctly.
432 for (auto *Succ : successors(&CallSiteBB))
433 if (Inserted.insert(Succ).second)
434 DomTreeUpdates.emplace_back(DominatorTree::UpdateKind::Delete,
435 const_cast<BasicBlock *>(&CallSiteBB),
436 const_cast<BasicBlock *>(Succ));
437 // Reuse Inserted (which has some allocated capacity at this point) below, if
438 // we have an invoke.
439 Inserted.clear();
440 // Inlining only handles invoke and calls. If this is an invoke, and inlining
441 // it pulls another invoke, the original landing pad may get split, so as to
442 // share its content with other potential users. So the edge up to which we
443 // need to invalidate and then re-account BB data is the successors of the
444 // current landing pad. We can leave the current lp, too - if it doesn't get
445 // split, then it will be the place traversal stops. Either way, the
446 // discounted BBs will be checked if reachable and re-added.
447 if (const auto *II = dyn_cast<InvokeInst>(&CB)) {
448 const auto *UnwindDest = II->getUnwindDest();
449 Successors.insert_range(successors(UnwindDest));
450 // Same idea as above, we pretend we lose all these edges.
451 for (auto *Succ : successors(UnwindDest))
452 if (Inserted.insert(Succ).second)
453 DomTreeUpdates.emplace_back(DominatorTree::UpdateKind::Delete,
454 const_cast<BasicBlock *>(UnwindDest),
455 const_cast<BasicBlock *>(Succ));
456 }
457
458 // Exclude the CallSiteBB, if it happens to be its own successor (1-BB loop).
459 // We are only interested in BBs the graph moves past the callsite BB to
460 // define the frontier past which we don't want to re-process BBs. Including
461 // the callsite BB in this case would prematurely stop the traversal in
462 // finish().
463 Successors.erase(&CallSiteBB);
464
465 LikelyToChangeBBs.insert_range(Successors);
466
467 // Commit the change. While some of the BBs accounted for above may play dual
468 // role - e.g. caller's entry BB may be the same as the callsite BB - set
469 // insertion semantics make sure we account them once. This needs to be
470 // followed in `finish`, too.
471 for (const auto *BB : LikelyToChangeBBs)
472 FPI.updateForBB(*BB, -1);
473}
474
475DominatorTree &FunctionPropertiesUpdater::getUpdatedDominatorTree(
477 auto &DT =
478 FAM.getResult<DominatorTreeAnalysis>(const_cast<Function &>(Caller));
479
481
483 for (auto *Succ : successors(&CallSiteBB))
484 if (Inserted.insert(Succ).second)
485 FinalDomTreeUpdates.push_back({DominatorTree::UpdateKind::Insert,
486 const_cast<BasicBlock *>(&CallSiteBB),
487 const_cast<BasicBlock *>(Succ)});
488
489 // Perform the deletes last, so that any new nodes connected to nodes
490 // participating in the edge deletion are known to the DT.
491 for (auto &Upd : DomTreeUpdates)
492 if (!llvm::is_contained(successors(Upd.getFrom()), Upd.getTo()))
493 FinalDomTreeUpdates.push_back(Upd);
494
495 DT.applyUpdates(FinalDomTreeUpdates);
496#ifdef EXPENSIVE_CHECKS
497 assert(DT.verify(DominatorTree::VerificationLevel::Full));
498#endif
499 return DT;
500}
501
503 // Update feature values from the BBs that were copied from the callee, or
504 // might have been modified because of inlining. The latter have been
505 // subtracted in the FunctionPropertiesUpdater ctor.
506 // There could be successors that were reached before but now are only
507 // reachable from elsewhere in the CFG.
508 // One example is the following diamond CFG (lines are arrows pointing down):
509 // A
510 // / \
511 // B C
512 // | |
513 // | D
514 // | |
515 // | E
516 // \ /
517 // F
518 // There's a call site in C that is inlined. Upon doing that, it turns out
519 // it expands to
520 // call void @llvm.trap()
521 // unreachable
522 // F isn't reachable from C anymore, but we did discount it when we set up
523 // FunctionPropertiesUpdater, so we need to re-include it here.
524 // At the same time, D and E were reachable before, but now are not anymore,
525 // so we need to leave D out (we discounted it at setup), and explicitly
526 // remove E.
529 auto &DT = getUpdatedDominatorTree(FAM);
530
531 if (&CallSiteBB != &*Caller.begin())
532 Reinclude.insert(&*Caller.begin());
533
534 // Reinclude the BBs which use the values returned by call instruction
535 Reinclude.insert_range(CallUsers);
536
537 // Distribute the successors to the 2 buckets.
538 for (const auto *Succ : Successors)
539 if (DT.isReachableFromEntry(Succ))
540 Reinclude.insert(Succ);
541 else
542 Unreachable.insert(Succ);
543
544 // For reinclusion, we want to stop at the reachable successors, who are at
545 // the beginning of the worklist; but, starting from the callsite bb and
546 // ending at those successors, we also want to perform a traversal.
547 // IncludeSuccessorsMark is the index after which we include successors.
548 const auto IncludeSuccessorsMark = Reinclude.size();
549 bool CSInsertion = Reinclude.insert(&CallSiteBB);
550 (void)CSInsertion;
551 assert(CSInsertion);
552 for (size_t I = 0; I < Reinclude.size(); ++I) {
553 const auto *BB = Reinclude[I];
554 FPI.reIncludeBB(*BB);
555 if (I >= IncludeSuccessorsMark)
556 Reinclude.insert_range(successors(BB));
557 }
558
559 // For exclusion, we don't need to exclude the set of BBs that were successors
560 // before and are now unreachable, because we already did that at setup. For
561 // the rest, as long as a successor is unreachable, we want to explicitly
562 // exclude it.
563 const auto AlreadyExcludedMark = Unreachable.size();
564 for (size_t I = 0; I < Unreachable.size(); ++I) {
565 const auto *U = Unreachable[I];
566 if (I >= AlreadyExcludedMark)
567 FPI.updateForBB(*U, -1);
568 for (const auto *Succ : successors(U))
569 if (!DT.isReachableFromEntry(Succ))
570 Unreachable.insert(Succ);
571 }
572
573 const auto &LI = FAM.getResult<LoopAnalysis>(const_cast<Function &>(Caller));
574 FPI.updateAggregateStats(Caller, LI);
575#ifdef EXPENSIVE_CHECKS
576 assert(isUpdateValid(Caller, FPI, FAM));
577#endif
578}
579
580bool FunctionPropertiesUpdater::isUpdateValid(Function &F,
581 const FunctionPropertiesInfo &FPI,
583 if (!FAM.getResult<DominatorTreeAnalysis>(F).verify(
584 DominatorTree::VerificationLevel::Full))
585 return false;
586 DominatorTree DT(F);
587 LoopInfo LI(DT);
588 auto Vocabulary = FAM.getResult<ModuleAnalysisManagerFunctionProxy>(F)
589 .getCachedResult<IR2VecVocabAnalysis>(*F.getParent());
590 auto Fresh =
592 return FPI == Fresh;
593}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static const Function * getParent(const Value *V)
#define LLVM_ABI
Definition Compiler.h:211
This file contains the declarations for the subclasses of Constant, which represent the different fla...
#define COUNT_OPERAND(OPTYPE)
This file provides various utilities for inspecting and working with the control flow graph in LLVM I...
Loop::LoopBounds::Direction Direction
Definition LoopInfo.cpp:254
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
uint64_t IntrinsicInst * II
FunctionAnalysisManager FAM
This file contains some templates that are useful if you are working with the STL at all.
This file implements a set that has insertion order iteration characteristics.
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define LLVM_DEBUG(...)
Definition Debug.h:119
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
LLVM Basic Block Representation.
Definition BasicBlock.h:62
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction; assumes that the block is well-formed.
Definition BasicBlock.h:237
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
LLVM_ABI bool isIndirectCall() const
Return true if the callsite is an indirect call.
iterator_range< User::op_iterator > args()
Iteration adapter for range-for loops.
bool doesNotReturn() const
Determine if the call cannot return.
unsigned arg_size() const
Implements a dense probed hash-table based set.
Definition DenseSet.h:281
Analysis pass which computes a DominatorTree.
Definition Dominators.h:241
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Definition Dominators.h:122
LLVM_ABI bool isReachableFromEntry(const Use &U) const
Provide an overload for a Use.
LLVM_ABI FunctionPropertiesInfo run(Function &F, FunctionAnalysisManager &FAM)
int64_t BasicBlockCount
Number of basic blocks.
int64_t Uses
Number of uses of this function, plus 1 if the function is callable outside the module.
int64_t BlocksReachedFromConditionalInstruction
Number of blocks reached from a conditional instruction, or that are 'cases' of a SwitchInstr.
LLVM_ABI bool operator==(const FunctionPropertiesInfo &FPI) const
static LLVM_ABI FunctionPropertiesInfo getFunctionPropertiesInfo(const Function &F, const DominatorTree &DT, const LoopInfo &LI, const ir2vec::Vocabulary *Vocabulary)
LLVM_ABI void print(raw_ostream &OS) const
int64_t DirectCallsToDefinedFunctions
Number of direct calls made from this function to other functions defined in this module.
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM)
LLVM_ABI FunctionPropertiesUpdater(FunctionPropertiesInfo &FPI, CallBase &CB)
LLVM_ABI void finish(FunctionAnalysisManager &FAM) const
iterator_range< user_iterator > users()
Analysis pass that exposes the LoopInfo for a function.
Definition LoopInfo.h:594
A set of analyses that are preserved following a run of a transformation pass.
Definition Analysis.h:112
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition Analysis.h:118
A vector that has set insertion semantics.
Definition SetVector.h:57
size_type size() const
Determine the number of elements in the SetVector.
Definition SetVector.h:103
void insert_range(Range &&R)
Definition SetVector.h:182
bool insert(const value_type &X)
Insert a new element into the SetVector.
Definition SetVector.h:157
void insert_range(Range &&R)
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
bool isVectorTy() const
True if this is an instance of VectorType.
Definition Type.h:283
bool isPointerTy() const
True if this is an instance of PointerType.
Definition Type.h:277
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
Definition Type.h:363
bool isFloatingPointTy() const
Return true if this is one of the floating-point types.
Definition Type.h:186
bool isIntegerTy() const
True if this is an instance of IntegerType.
Definition Type.h:252
Type * getType() const
All values are typed, get the type of this value.
Definition Value.h:257
static LLVM_ABI std::unique_ptr< Embedder > create(IR2VecKind Mode, const Function &F, const Vocabulary &Vocab)
Factory method to create an Embedder object.
Definition IR2Vec.cpp:156
Class for storing and accessing the IR2Vec vocabulary.
Definition IR2Vec.h:248
unsigned getDimension() const
Definition IR2Vec.h:349
bool isValid() const
Definition IR2Vec.h:347
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
CallInst * Call
initializer< Ty > init(const Ty &Val)
friend class Instruction
Iterator for Instructions in a `BasicBlock.
Definition BasicBlock.h:73
This is an optimization pass for GlobalISel generic memory operations.
Printable print(const GCNRegPressure &RP, const GCNSubtarget *ST=nullptr, unsigned DynamicVGPRBlockSize=0)
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
Definition STLExtras.h:1685
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:643
auto successors(const MachineBasicBlock *BB)
OuterAnalysisManagerProxy< ModuleAnalysisManager, Function > ModuleAnalysisManagerFunctionProxy
Provide the ModuleAnalysisManager to Function proxy.
LLVM_ABI cl::opt< bool > EnableDetailedFunctionProperties("enable-detailed-function-properties", cl::Hidden, cl::init(false), cl::desc("Whether or not to compute detailed function properties."))
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
Definition STLExtras.h:2224
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
Definition InstrProf.h:143
const AnalysisOptions & getAnalysisOptions(const LLVMContext &C)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition Debug.cpp:209
auto succ_size(const MachineBasicBlock *BB)
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
Definition Casting.h:547
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
Definition STLExtras.h:1963
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition Analysis.h:29
Embedding is a datatype that wraps std::vector<double>.
Definition IR2Vec.h:88