Skip to content

Commit a006991

Browse files
author
git apple-llvm automerger
committed
Merge commit 'fbd00a47754c' from llvm.org/main into next
2 parents d5c7109 + fbd00a4 commit a006991

File tree

1 file changed

+10
-23
lines changed

1 file changed

+10
-23
lines changed

llvm/include/llvm/Analysis/RegionInfoImpl.h

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,7 @@ typename RegionBase<Tr>::BlockT *RegionBase<Tr>::getEnteringBlock() const {
163163
assert(!AllowRepeats && "Unexpected parameter value.");
164164
return DT->getNode(Pred) && !contains(Pred) ? Pred : nullptr;
165165
};
166-
BlockT *entry = getEntry();
167-
return find_singleton<BlockT>(make_range(InvBlockTraits::child_begin(entry),
168-
InvBlockTraits::child_end(entry)),
166+
return find_singleton<BlockT>(llvm::inverse_children<BlockT *>(getEntry()),
169167
isEnteringBlock);
170168
}
171169

@@ -177,10 +175,7 @@ bool RegionBase<Tr>::getExitingBlocks(
177175
if (!exit)
178176
return CoverAll;
179177

180-
for (PredIterTy PI = InvBlockTraits::child_begin(exit),
181-
PE = InvBlockTraits::child_end(exit);
182-
PI != PE; ++PI) {
183-
BlockT *Pred = *PI;
178+
for (BlockT *Pred : llvm::inverse_children<BlockT *>(exit)) {
184179
if (contains(Pred)) {
185180
Exitings.push_back(Pred);
186181
continue;
@@ -202,8 +197,7 @@ typename RegionBase<Tr>::BlockT *RegionBase<Tr>::getExitingBlock() const {
202197
assert(!AllowRepeats && "Unexpected parameter value.");
203198
return contains(Pred) ? Pred : nullptr;
204199
};
205-
return find_singleton<BlockT>(make_range(InvBlockTraits::child_begin(exit),
206-
InvBlockTraits::child_end(exit)),
200+
return find_singleton<BlockT>(llvm::inverse_children<BlockT *>(exit),
207201
isContained);
208202
}
209203

@@ -244,16 +238,14 @@ void RegionBase<Tr>::verifyBBInRegion(BlockT *BB) const {
244238

245239
BlockT *entry = getEntry(), *exit = getExit();
246240

247-
for (BlockT *Succ :
248-
make_range(BlockTraits::child_begin(BB), BlockTraits::child_end(BB))) {
241+
for (BlockT *Succ : llvm::children<BlockT *>(BB)) {
249242
if (!contains(Succ) && exit != Succ)
250243
report_fatal_error("Broken region found: edges leaving the region must go "
251244
"to the exit node!");
252245
}
253246

254247
if (entry != BB) {
255-
for (BlockT *Pred : make_range(InvBlockTraits::child_begin(BB),
256-
InvBlockTraits::child_end(BB))) {
248+
for (BlockT *Pred : llvm::inverse_children<BlockT *>(BB)) {
257249
// Allow predecessors that are unreachable, as these are ignored during
258250
// region analysis.
259251
if (!contains(Pred) && DT->isReachableFromEntry(Pred))
@@ -271,8 +263,7 @@ void RegionBase<Tr>::verifyWalk(BlockT *BB, std::set<BlockT *> *visited) const {
271263

272264
verifyBBInRegion(BB);
273265

274-
for (BlockT *Succ :
275-
make_range(BlockTraits::child_begin(BB), BlockTraits::child_end(BB))) {
266+
for (BlockT *Succ : llvm::children<BlockT *>(BB)) {
276267
if (Succ != exit && visited->find(Succ) == visited->end())
277268
verifyWalk(Succ, visited);
278269
}
@@ -453,8 +444,7 @@ typename Tr::RegionT *RegionBase<Tr>::getExpandedRegion() const {
453444
RegionT *R = RI->getRegionFor(exit);
454445

455446
if (R->getEntry() != exit) {
456-
for (BlockT *Pred : make_range(InvBlockTraits::child_begin(getExit()),
457-
InvBlockTraits::child_end(getExit())))
447+
for (BlockT *Pred : llvm::inverse_children<BlockT *>(getExit()))
458448
if (!contains(Pred))
459449
return nullptr;
460450
if (Tr::getNumSuccessors(exit) == 1)
@@ -465,8 +455,7 @@ typename Tr::RegionT *RegionBase<Tr>::getExpandedRegion() const {
465455
while (R->getParent() && R->getParent()->getEntry() == exit)
466456
R = R->getParent();
467457

468-
for (BlockT *Pred : make_range(InvBlockTraits::child_begin(getExit()),
469-
InvBlockTraits::child_end(getExit()))) {
458+
for (BlockT *Pred : llvm::inverse_children<BlockT *>(getExit())) {
470459
if (!(contains(Pred) || R->contains(Pred)))
471460
return nullptr;
472461
}
@@ -553,8 +542,7 @@ void RegionInfoBase<Tr>::verifyBBMap(const RegionT *R) const {
553542
template <class Tr>
554543
bool RegionInfoBase<Tr>::isCommonDomFrontier(BlockT *BB, BlockT *entry,
555544
BlockT *exit) const {
556-
for (BlockT *P : make_range(InvBlockTraits::child_begin(BB),
557-
InvBlockTraits::child_end(BB))) {
545+
for (BlockT *P : llvm::inverse_children<BlockT *>(BB)) {
558546
if (DT->dominates(entry, P) && !DT->dominates(exit, P))
559547
return false;
560548
}
@@ -837,8 +825,7 @@ RegionInfoBase<Tr>::getMaxRegionExit(BlockT *BB) const {
837825
ExitR->getParent()->getEntry() == Exit)
838826
ExitR = ExitR->getParent();
839827

840-
for (BlockT *Pred : make_range(InvBlockTraits::child_begin(Exit),
841-
InvBlockTraits::child_end(Exit))) {
828+
for (BlockT *Pred : llvm::inverse_children<BlockT *>(Exit)) {
842829
if (!R->contains(Pred) && !ExitR->contains(Pred))
843830
break;
844831
}

0 commit comments

Comments
 (0)