@@ -115,7 +115,7 @@ bool LoopBase<BlockT, LoopT>::hasDedicatedExits() const {
115
115
SmallVector<BlockT *, 4 > UniqueExitBlocks;
116
116
getUniqueExitBlocks (UniqueExitBlocks);
117
117
for (BlockT *EB : UniqueExitBlocks)
118
- for (BlockT *Predecessor : children<Inverse< BlockT *> >(EB))
118
+ for (BlockT *Predecessor : inverse_children< BlockT *>(EB))
119
119
if (!contains (Predecessor))
120
120
return false ;
121
121
// All the requirements are met.
@@ -208,10 +208,7 @@ BlockT *LoopBase<BlockT, LoopT>::getLoopPreheader() const {
208
208
return nullptr ;
209
209
210
210
// Make sure there is only one exit out of the preheader.
211
- typedef GraphTraits<BlockT *> BlockTraits;
212
- typename BlockTraits::ChildIteratorType SI = BlockTraits::child_begin (Out);
213
- ++SI;
214
- if (SI != BlockTraits::child_end (Out))
211
+ if (llvm::size (llvm::children<BlockT *>(Out)) != 1 )
215
212
return nullptr ; // Multiple exits from the block, must not be a preheader.
216
213
217
214
// The predecessor has exactly one successor, so it is a preheader.
@@ -231,7 +228,7 @@ BlockT *LoopBase<BlockT, LoopT>::getLoopPredecessor() const {
231
228
232
229
// Loop over the predecessors of the header node...
233
230
BlockT *Header = getHeader ();
234
- for (const auto Pred : children<Inverse< BlockT *> >(Header)) {
231
+ for (const auto Pred : inverse_children< BlockT *>(Header)) {
235
232
if (!contains (Pred)) { // If the block is not in the loop...
236
233
if (Out && Out != Pred)
237
234
return nullptr ; // Multiple predecessors outside the loop
@@ -249,7 +246,7 @@ BlockT *LoopBase<BlockT, LoopT>::getLoopLatch() const {
249
246
assert (!isInvalid () && " Loop not in a valid state!" );
250
247
BlockT *Header = getHeader ();
251
248
BlockT *Latch = nullptr ;
252
- for (const auto Pred : children<Inverse< BlockT *> >(Header)) {
249
+ for (const auto Pred : inverse_children< BlockT *>(Header)) {
253
250
if (contains (Pred)) {
254
251
if (Latch)
255
252
return nullptr ;
@@ -331,20 +328,16 @@ void LoopBase<BlockT, LoopT>::verifyLoop() const {
331
328
332
329
// Check the individual blocks.
333
330
for (BlockT *BB : depth_first_ext (getHeader (), VisitSet)) {
334
- assert (std::any_of (GraphTraits<BlockT *>::child_begin (BB),
335
- GraphTraits<BlockT *>::child_end (BB),
336
- [&](BlockT *B) { return contains (B); }) &&
331
+ assert (llvm::any_of (children<BlockT *>(BB),
332
+ [&](BlockT *B) { return contains (B); }) &&
337
333
" Loop block has no in-loop successors!" );
338
334
339
- assert (std::any_of (GraphTraits<Inverse<BlockT *>>::child_begin (BB),
340
- GraphTraits<Inverse<BlockT *>>::child_end (BB),
341
- [&](BlockT *B) { return contains (B); }) &&
335
+ assert (llvm::any_of (inverse_children<BlockT *>(BB),
336
+ [&](BlockT *B) { return contains (B); }) &&
342
337
" Loop block has no in-loop predecessors!" );
343
338
344
339
SmallVector<BlockT *, 2 > OutsideLoopPreds;
345
- for (BlockT *B :
346
- llvm::make_range (GraphTraits<Inverse<BlockT *>>::child_begin (BB),
347
- GraphTraits<Inverse<BlockT *>>::child_end (BB)))
340
+ for (BlockT *B : inverse_children<BlockT *>(BB))
348
341
if (!contains (B))
349
342
OutsideLoopPreds.push_back (B);
350
343
@@ -496,7 +489,7 @@ static void discoverAndMapSubloop(LoopT *L, ArrayRef<BlockT *> Backedges,
496
489
// within this subloop tree itself. Note that a predecessor may directly
497
490
// reach another subloop that is not yet discovered to be a subloop of
498
491
// this loop, which we must traverse.
499
- for (const auto Pred : children<Inverse< BlockT *> >(PredBB)) {
492
+ for (const auto Pred : inverse_children< BlockT *>(PredBB)) {
500
493
if (LI->getLoopFor (Pred) != Subloop)
501
494
ReverseCFGWorklist.push_back (Pred);
502
495
}
@@ -579,7 +572,7 @@ void LoopInfoBase<BlockT, LoopT>::analyze(const DomTreeBase<BlockT> &DomTree) {
579
572
SmallVector<BlockT *, 4 > Backedges;
580
573
581
574
// Check each predecessor of the potential loop header.
582
- for (const auto Backedge : children<Inverse< BlockT *> >(Header)) {
575
+ for (const auto Backedge : inverse_children< BlockT *>(Header)) {
583
576
// If Header dominates predBB, this is a new loop. Collect the backedges.
584
577
const DomTreeNodeBase<BlockT> *BackedgeNode = DomTree.getNode (Backedge);
585
578
if (BackedgeNode && DomTree.dominates (DomNode, BackedgeNode))
0 commit comments