LLVM 23.0.0git
LoopNestAnalysis.cpp
Go to the documentation of this file.
1//===- LoopNestAnalysis.cpp - Loop Nest 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/// \file
10/// The implementation for the loop nest analysis.
11///
12//===----------------------------------------------------------------------===//
13
18
19using namespace llvm;
20
21#define DEBUG_TYPE "loopnest"
22#ifndef NDEBUG
23static const char *VerboseDebug = DEBUG_TYPE "-verbose";
24#endif
25
26/// Determine whether the loops structure violates basic requirements for
27/// perfect nesting:
28/// - the inner loop should be the outer loop's only child
29/// - the outer loop header should 'flow' into the inner loop preheader
30/// or jump around the inner loop to the outer loop latch
31/// - if the inner loop latch exits the inner loop, it should 'flow' into
32/// the outer loop latch.
33/// Returns true if the loop structure satisfies the basic requirements and
34/// false otherwise.
35static bool checkLoopsStructure(const Loop &OuterLoop, const Loop &InnerLoop,
36 ScalarEvolution &SE);
37
38//===----------------------------------------------------------------------===//
39// LoopNest implementation
40//
41
46
47std::unique_ptr<LoopNest> LoopNest::getLoopNest(Loop &Root,
48 ScalarEvolution &SE) {
49 return std::make_unique<LoopNest>(Root, SE);
50}
51
52static CmpInst *getOuterLoopLatchCmp(const Loop &OuterLoop) {
53
54 const BasicBlock *Latch = OuterLoop.getLoopLatch();
55 assert(Latch && "Expecting a valid loop latch");
56
57 const CondBrInst *BI = dyn_cast<CondBrInst>(Latch->getTerminator());
58 assert(BI && "Expecting loop latch terminator to be a branch instruction");
59
60 CmpInst *OuterLoopLatchCmp = dyn_cast<CmpInst>(BI->getCondition());
62 VerboseDebug, if (OuterLoopLatchCmp) {
63 dbgs() << "Outer loop latch compare instruction: " << *OuterLoopLatchCmp
64 << "\n";
65 });
66 return OuterLoopLatchCmp;
67}
68
69static CmpInst *getInnerLoopGuardCmp(const Loop &InnerLoop) {
70 CondBrInst *InnerGuard = InnerLoop.getLoopGuardBranch();
71 CmpInst *InnerLoopGuardCmp =
72 (InnerGuard) ? dyn_cast<CmpInst>(InnerGuard->getCondition()) : nullptr;
73
75 VerboseDebug, if (InnerLoopGuardCmp) {
76 dbgs() << "Inner loop guard compare instruction: " << *InnerLoopGuardCmp
77 << "\n";
78 });
79 return InnerLoopGuardCmp;
80}
81
83 const CmpInst *InnerLoopGuardCmp,
84 const CmpInst *OuterLoopLatchCmp,
85 std::optional<Loop::LoopBounds> OuterLoopLB) {
86
87 bool IsAllowed = isSafeToSpeculativelyExecute(&I) || isa<PHINode>(I) ||
89 if (!IsAllowed)
90 return false;
91 // The only binary instruction allowed is the outer loop step instruction,
92 // the only comparison instructions allowed are the inner loop guard
93 // compare instruction and the outer loop latch compare instruction.
94 if ((isa<BinaryOperator>(I) && &I != &OuterLoopLB->getStepInst()) ||
95 (isa<CmpInst>(I) && &I != OuterLoopLatchCmp && &I != InnerLoopGuardCmp)) {
96 return false;
97 }
98 return true;
99}
100
101bool LoopNest::arePerfectlyNested(const Loop &OuterLoop, const Loop &InnerLoop,
102 ScalarEvolution &SE) {
103 return (analyzeLoopNestForPerfectNest(OuterLoop, InnerLoop, SE) ==
104 PerfectLoopNest);
105}
106
107LoopNest::LoopNestEnum LoopNest::analyzeLoopNestForPerfectNest(
108 const Loop &OuterLoop, const Loop &InnerLoop, ScalarEvolution &SE) {
109
110 assert(!OuterLoop.isInnermost() && "Outer loop should have subloops");
111 assert(!InnerLoop.isOutermost() && "Inner loop should have a parent");
112 LLVM_DEBUG(dbgs() << "Checking whether loop '" << OuterLoop.getName()
113 << "' and '" << InnerLoop.getName()
114 << "' are perfectly nested.\n");
115
116 // Determine whether the loops structure satisfies the following requirements:
117 // - the inner loop should be the outer loop's only child
118 // - the outer loop header should 'flow' into the inner loop preheader
119 // or jump around the inner loop to the outer loop latch
120 // - if the inner loop latch exits the inner loop, it should 'flow' into
121 // the outer loop latch.
122 if (!checkLoopsStructure(OuterLoop, InnerLoop, SE)) {
123 LLVM_DEBUG(dbgs() << "Not perfectly nested: invalid loop structure.\n");
124 return InvalidLoopStructure;
125 }
126
127 // Bail out if we cannot retrieve the outer loop bounds.
128 auto OuterLoopLB = OuterLoop.getBounds(SE);
129 if (OuterLoopLB == std::nullopt) {
130 LLVM_DEBUG(dbgs() << "Cannot compute loop bounds of OuterLoop: "
131 << OuterLoop << "\n";);
132 return OuterLoopLowerBoundUnknown;
133 }
134
135 CmpInst *OuterLoopLatchCmp = getOuterLoopLatchCmp(OuterLoop);
136 CmpInst *InnerLoopGuardCmp = getInnerLoopGuardCmp(InnerLoop);
137
138 // Determine whether instructions in a basic block are one of:
139 // - the inner loop guard comparison
140 // - the outer loop latch comparison
141 // - the outer loop induction variable increment
142 // - a phi node, a cast or a branch
143 auto containsOnlySafeInstructions = [&](const BasicBlock &BB) {
144 return llvm::all_of(BB, [&](const Instruction &I) {
145 bool IsSafeInstr = checkSafeInstruction(I, InnerLoopGuardCmp,
146 OuterLoopLatchCmp, OuterLoopLB);
147 if (IsSafeInstr) {
149 dbgs() << "Instruction: " << I << "\nin basic block:" << BB
150 << "is unsafe.\n";
151 });
152 }
153 return IsSafeInstr;
154 });
155 };
156
157 // Check the code surrounding the inner loop for instructions that are deemed
158 // unsafe.
159 const BasicBlock *OuterLoopHeader = OuterLoop.getHeader();
160 const BasicBlock *OuterLoopLatch = OuterLoop.getLoopLatch();
161 const BasicBlock *InnerLoopPreHeader = InnerLoop.getLoopPreheader();
162
163 if (!containsOnlySafeInstructions(*OuterLoopHeader) ||
164 !containsOnlySafeInstructions(*OuterLoopLatch) ||
165 (InnerLoopPreHeader != OuterLoopHeader &&
166 !containsOnlySafeInstructions(*InnerLoopPreHeader)) ||
167 !containsOnlySafeInstructions(*InnerLoop.getExitBlock())) {
168 LLVM_DEBUG(dbgs() << "Not perfectly nested: code surrounding inner loop is "
169 "unsafe\n";);
170 return ImperfectLoopNest;
171 }
172
173 LLVM_DEBUG(dbgs() << "Loop '" << OuterLoop.getName() << "' and '"
174 << InnerLoop.getName() << "' are perfectly nested.\n");
175
176 return PerfectLoopNest;
177}
178
180 const Loop &OuterLoop, const Loop &InnerLoop, ScalarEvolution &SE) {
181 InstrVectorTy Instr;
182 switch (analyzeLoopNestForPerfectNest(OuterLoop, InnerLoop, SE)) {
183 case PerfectLoopNest:
184 LLVM_DEBUG(dbgs() << "The loop Nest is Perfect, returning empty "
185 "instruction vector. \n";);
186 return Instr;
187
188 case InvalidLoopStructure:
189 LLVM_DEBUG(dbgs() << "Not perfectly nested: invalid loop structure. "
190 "Instruction vector is empty.\n";);
191 return Instr;
192
193 case OuterLoopLowerBoundUnknown:
194 LLVM_DEBUG(dbgs() << "Cannot compute loop bounds of OuterLoop: "
195 << OuterLoop << "\nInstruction vector is empty.\n";);
196 return Instr;
197
198 case ImperfectLoopNest:
199 break;
200 }
201
202 // Identify the outer loop latch comparison instruction.
203 auto OuterLoopLB = OuterLoop.getBounds(SE);
204
205 CmpInst *OuterLoopLatchCmp = getOuterLoopLatchCmp(OuterLoop);
206 CmpInst *InnerLoopGuardCmp = getInnerLoopGuardCmp(InnerLoop);
207
208 auto GetUnsafeInstructions = [&](const BasicBlock &BB) {
209 for (const Instruction &I : BB) {
210 if (!checkSafeInstruction(I, InnerLoopGuardCmp, OuterLoopLatchCmp,
211 OuterLoopLB)) {
212 Instr.push_back(&I);
214 dbgs() << "Instruction: " << I << "\nin basic block:" << BB
215 << "is unsafe.\n";
216 });
217 }
218 }
219 };
220
221 // Check the code surrounding the inner loop for instructions that are deemed
222 // unsafe.
223 const BasicBlock *OuterLoopHeader = OuterLoop.getHeader();
224 const BasicBlock *OuterLoopLatch = OuterLoop.getLoopLatch();
225 const BasicBlock *InnerLoopPreHeader = InnerLoop.getLoopPreheader();
226 const BasicBlock *InnerLoopExitBlock = InnerLoop.getExitBlock();
227
228 GetUnsafeInstructions(*OuterLoopHeader);
229 GetUnsafeInstructions(*OuterLoopLatch);
230 GetUnsafeInstructions(*InnerLoopExitBlock);
231
232 if (InnerLoopPreHeader != OuterLoopHeader) {
233 GetUnsafeInstructions(*InnerLoopPreHeader);
234 }
235 return Instr;
236}
237
241 LoopVectorTy PerfectNest;
242
243 for (Loop *L : depth_first(const_cast<Loop *>(Loops.front()))) {
244 if (PerfectNest.empty())
245 PerfectNest.push_back(L);
246
247 auto &SubLoops = L->getSubLoops();
248 if (SubLoops.size() == 1 && arePerfectlyNested(*L, *SubLoops.front(), SE)) {
249 PerfectNest.push_back(SubLoops.front());
250 } else {
251 LV.push_back(PerfectNest);
252 PerfectNest.clear();
253 }
254 }
255
256 return LV;
257}
258
260 LLVM_DEBUG(dbgs() << "Get maximum perfect depth of loop nest rooted by loop '"
261 << Root.getName() << "'\n");
262
263 const Loop *CurrentLoop = &Root;
264 const auto *SubLoops = &CurrentLoop->getSubLoops();
265 unsigned CurrentDepth = 1;
266
267 while (SubLoops->size() == 1) {
268 const Loop *InnerLoop = SubLoops->front();
269 if (!arePerfectlyNested(*CurrentLoop, *InnerLoop, SE)) {
270 LLVM_DEBUG({
271 dbgs() << "Not a perfect nest: loop '" << CurrentLoop->getName()
272 << "' is not perfectly nested with loop '"
273 << InnerLoop->getName() << "'\n";
274 });
275 break;
276 }
277
278 CurrentLoop = InnerLoop;
279 SubLoops = &CurrentLoop->getSubLoops();
280 ++CurrentDepth;
281 }
282
283 return CurrentDepth;
284}
285
287 const BasicBlock *End,
288 bool CheckUniquePred) {
289 assert(From && "Expecting valid From");
290 assert(End && "Expecting valid End");
291
292 if (From == End || !From->getUniqueSuccessor())
293 return *From;
294
295 auto IsEmpty = [](const BasicBlock *BB) {
296 return (BB->size() == 1);
297 };
298
299 // Visited is used to avoid running into an infinite loop.
301 const BasicBlock *BB = From->getUniqueSuccessor();
302 const BasicBlock *PredBB = From;
303 while (BB && BB != End && IsEmpty(BB) && !Visited.count(BB) &&
304 (!CheckUniquePred || BB->getUniquePredecessor())) {
305 Visited.insert(BB);
306 PredBB = BB;
307 BB = BB->getUniqueSuccessor();
308 }
309
310 return (BB == End) ? *End : *PredBB;
311}
312
313static bool checkLoopsStructure(const Loop &OuterLoop, const Loop &InnerLoop,
314 ScalarEvolution &SE) {
315 // The inner loop must be the only outer loop's child.
316 if ((OuterLoop.getSubLoops().size() != 1) ||
317 (InnerLoop.getParentLoop() != &OuterLoop))
318 return false;
319
320 // We expect loops in normal form which have a preheader, header, latch...
321 if (!OuterLoop.isLoopSimplifyForm() || !InnerLoop.isLoopSimplifyForm())
322 return false;
323
324 const BasicBlock *OuterLoopHeader = OuterLoop.getHeader();
325 const BasicBlock *OuterLoopLatch = OuterLoop.getLoopLatch();
326 const BasicBlock *InnerLoopPreHeader = InnerLoop.getLoopPreheader();
327 const BasicBlock *InnerLoopLatch = InnerLoop.getLoopLatch();
328 const BasicBlock *InnerLoopExit = InnerLoop.getExitBlock();
329
330 // We expect rotated loops. The inner loop should have a single exit block.
331 if (OuterLoop.getExitingBlock() != OuterLoopLatch ||
332 InnerLoop.getExitingBlock() != InnerLoopLatch || !InnerLoopExit)
333 return false;
334
335 // Returns whether the block `ExitBlock` contains at least one LCSSA Phi node.
336 auto ContainsLCSSAPhi = [](const BasicBlock &ExitBlock) {
337 return any_of(ExitBlock.phis(), [](const PHINode &PN) {
338 return PN.getNumIncomingValues() == 1;
339 });
340 };
341
342 // Returns whether the block `BB` qualifies for being an extra Phi block. The
343 // extra Phi block is the additional block inserted after the exit block of an
344 // "guarded" inner loop which contains "only" Phi nodes corresponding to the
345 // LCSSA Phi nodes in the exit block.
346 auto IsExtraPhiBlock = [&](const BasicBlock &BB) {
347 return &*BB.getFirstNonPHIIt() == BB.getTerminator() &&
348 all_of(BB.phis(), [&](const PHINode &PN) {
349 return all_of(PN.blocks(), [&](const BasicBlock *IncomingBlock) {
350 return IncomingBlock == InnerLoopExit ||
351 IncomingBlock == OuterLoopHeader;
352 });
353 });
354 };
355
356 const BasicBlock *ExtraPhiBlock = nullptr;
357 // Ensure the only branch that may exist between the loops is the inner loop
358 // guard.
359 if (OuterLoopHeader != InnerLoopPreHeader) {
360 const BasicBlock &SingleSucc =
361 LoopNest::skipEmptyBlockUntil(OuterLoopHeader, InnerLoopPreHeader);
362
363 // no conditional branch present
364 if (&SingleSucc != InnerLoopPreHeader) {
365 const CondBrInst *BI = dyn_cast<CondBrInst>(SingleSucc.getTerminator());
366
367 if (!BI || BI != InnerLoop.getLoopGuardBranch())
368 return false;
369
370 bool InnerLoopExitContainsLCSSA = ContainsLCSSAPhi(*InnerLoopExit);
371
372 // The successors of the inner loop guard should be the inner loop
373 // preheader or the outer loop latch possibly through empty blocks.
374 for (const BasicBlock *Succ : BI->successors()) {
375 const BasicBlock *PotentialInnerPreHeader = Succ;
376 const BasicBlock *PotentialOuterLatch = Succ;
377
378 // Ensure the inner loop guard successor is empty before skipping
379 // blocks.
380 if (Succ->size() == 1) {
381 PotentialInnerPreHeader =
382 &LoopNest::skipEmptyBlockUntil(Succ, InnerLoopPreHeader);
383 PotentialOuterLatch =
384 &LoopNest::skipEmptyBlockUntil(Succ, OuterLoopLatch);
385 }
386
387 if (PotentialInnerPreHeader == InnerLoopPreHeader)
388 continue;
389 if (PotentialOuterLatch == OuterLoopLatch)
390 continue;
391
392 // If `InnerLoopExit` contains LCSSA Phi instructions, additional block
393 // may be inserted before the `OuterLoopLatch` to which `BI` jumps. The
394 // loops are still considered perfectly nested if the extra block only
395 // contains Phi instructions from InnerLoopExit and OuterLoopHeader.
396 if (InnerLoopExitContainsLCSSA && IsExtraPhiBlock(*Succ) &&
397 Succ->getSingleSuccessor() == OuterLoopLatch) {
398 // Points to the extra block so that we can reference it later in the
399 // final check. We can also conclude that the inner loop is
400 // guarded and there exists LCSSA Phi node in the exit block later if
401 // we see a non-null `ExtraPhiBlock`.
402 ExtraPhiBlock = Succ;
403 continue;
404 }
405
407 dbgs() << "Inner loop guard successor " << Succ->getName()
408 << " doesn't lead to inner loop preheader or "
409 "outer loop latch.\n";
410 });
411 return false;
412 }
413 }
414 }
415
416 // Ensure the inner loop exit block lead to the outer loop latch possibly
417 // through empty blocks.
418 if ((!ExtraPhiBlock ||
420 ExtraPhiBlock) != ExtraPhiBlock) &&
422 OuterLoopLatch) != OuterLoopLatch)) {
425 dbgs() << "Inner loop exit block " << *InnerLoopExit
426 << " does not directly lead to the outer loop latch.\n";);
427 return false;
428 }
429
430 return true;
431}
432
433AnalysisKey LoopNestAnalysis::Key;
434
436 OS << "IsPerfect=";
437 if (LN.getMaxPerfectDepth() == LN.getNestDepth())
438 OS << "true";
439 else
440 OS << "false";
441 OS << ", Depth=" << LN.getNestDepth();
442 OS << ", OutermostLoop: " << LN.getOutermostLoop().getName();
443 OS << ", Loops: ( ";
444 for (const Loop *L : LN.getLoops())
445 OS << L->getName() << " ";
446 OS << ")";
447
448 return OS;
449}
450
451//===----------------------------------------------------------------------===//
452// LoopNestPrinterPass implementation
453//
454
457 LPMUpdater &U) {
458 if (auto LN = LoopNest::getLoopNest(L, AR.SE))
459 OS << *LN << "\n";
460
461 return PreservedAnalyses::all();
462}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file builds on the ADT/GraphTraits.h file to build a generic breadth first graph iterator.
This file builds on the ADT/GraphTraits.h file to build generic depth first graph iterator.
#define DEBUG_TYPE
static CmpInst * getOuterLoopLatchCmp(const Loop &OuterLoop)
static CmpInst * getInnerLoopGuardCmp(const Loop &InnerLoop)
static bool checkSafeInstruction(const Instruction &I, const CmpInst *InnerLoopGuardCmp, const CmpInst *OuterLoopLatchCmp, std::optional< Loop::LoopBounds > OuterLoopLB)
static bool checkLoopsStructure(const Loop &OuterLoop, const Loop &InnerLoop, ScalarEvolution &SE)
Determine whether the loops structure violates basic requirements for perfect nesting:
static const char * VerboseDebug
This file defines the interface for the loop nest analysis.
#define I(x, y, z)
Definition MD5.cpp:57
#define LLVM_DEBUG(...)
Definition Debug.h:114
#define DEBUG_WITH_TYPE(TYPE,...)
DEBUG_WITH_TYPE macro - This macro should be used by passes to emit debug information.
Definition Debug.h:72
LLVM Basic Block Representation.
Definition BasicBlock.h:62
LLVM_ABI const BasicBlock * getUniqueSuccessor() const
Return the successor of this block if it has a unique successor.
LLVM_ABI const BasicBlock * getUniquePredecessor() const
Return the predecessor of this block if it has a unique predecessor block.
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
Definition BasicBlock.h:233
This class is the base class for the comparison instructions.
Definition InstrTypes.h:664
Conditional Branch instruction.
Value * getCondition() const
iterator_range< succ_iterator > successors()
This class provides an interface for updating the loop pass manager based on mutations to the loop ne...
bool isOutermost() const
Return true if the loop does not have a parent (natural) loop.
BlockT * getLoopLatch() const
If there is a single latch block for this loop, return it.
bool isInnermost() const
Return true if the loop does not contain any (natural) loops.
const std::vector< LoopT * > & getSubLoops() const
Return the loops contained entirely within this loop.
BlockT * getHeader() const
BlockT * getExitBlock() const
If getExitBlocks would return exactly one block, return that block.
BlockT * getLoopPreheader() const
If there is a preheader for this loop, return it.
BlockT * getExitingBlock() const
If getExitingBlocks would return exactly one block, return that block.
LoopT * getParentLoop() const
Return the parent loop if it exists or nullptr for top level loops.
LLVM_ABI PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM, LoopStandardAnalysisResults &AR, LPMUpdater &U)
This class represents a loop nest and can be used to query its properties.
static const BasicBlock & skipEmptyBlockUntil(const BasicBlock *From, const BasicBlock *End, bool CheckUniquePred=false)
Recursivelly traverse all empty 'single successor' basic blocks of From (if there are any).
ArrayRef< Loop * > getLoops() const
Get the loops in the nest.
unsigned getNestDepth() const
Return the loop nest depth (i.e.
LoopVectorTy Loops
LoopNest()=delete
SmallVector< LoopVectorTy, 4 > getPerfectLoops(ScalarEvolution &SE) const
Retrieve a vector of perfect loop nests contained in the current loop nest.
static bool arePerfectlyNested(const Loop &OuterLoop, const Loop &InnerLoop, ScalarEvolution &SE)
Return true if the given loops OuterLoop and InnerLoop are perfectly nested with respect to each othe...
static InstrVectorTy getInterveningInstructions(const Loop &OuterLoop, const Loop &InnerLoop, ScalarEvolution &SE)
Return a vector of instructions that prevent the LoopNest given by loops OuterLoop and InnerLoop from...
const unsigned MaxPerfectDepth
static std::unique_ptr< LoopNest > getLoopNest(Loop &Root, ScalarEvolution &SE)
Construct a LoopNest object.
SmallVector< const Instruction * > InstrVectorTy
unsigned getMaxPerfectDepth() const
Return the maximum perfect nesting depth.
static unsigned getMaxPerfectDepth(const Loop &Root, ScalarEvolution &SE)
Return the maximum nesting depth of the loop nest rooted by loop Root.
Loop & getOutermostLoop() const
Return the outermost loop in the loop nest.
Represents a single loop in the control flow graph.
Definition LoopInfo.h:40
std::optional< LoopBounds > getBounds(ScalarEvolution &SE) const
Return the struct LoopBounds collected if all struct members are found, else std::nullopt.
Definition LoopInfo.cpp:309
CondBrInst * getLoopGuardBranch() const
Return the loop guard branch, if it exists.
Definition LoopInfo.cpp:389
StringRef getName() const
Definition LoopInfo.h:389
bool isLoopSimplifyForm() const
Return true if the Loop is in the form that the LoopSimplify form transforms loops to,...
Definition LoopInfo.cpp:501
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
The main scalar evolution driver.
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
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.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
@ BasicBlock
Various leaf nodes.
Definition ISDOpcodes.h:81
This is an optimization pass for GlobalISel generic memory operations.
Definition Types.h:26
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1739
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:643
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
Definition STLExtras.h:2208
LLVM_ABI bool isSafeToSpeculativelyExecute(const Instruction *I, const Instruction *CtxI=nullptr, AssumptionCache *AC=nullptr, const DominatorTree *DT=nullptr, const TargetLibraryInfo *TLI=nullptr, bool UseVariableInfo=true, bool IgnoreUBImplyingAttrs=true)
Return true if the instruction does not have any effects besides calculating the result and does not ...
AnalysisManager< Loop, LoopStandardAnalysisResults & > LoopAnalysisManager
The loop analysis manager.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1746
SmallVector< Loop *, 8 > LoopVectorTy
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition Debug.cpp:207
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
iterator_range< bf_iterator< T > > breadth_first(const T &G)
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
iterator_range< df_iterator< T > > depth_first(const T &G)
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition Analysis.h:29
The adaptor from a function pass to a loop pass computes these analyses and makes them available to t...