Skip to content

Commit 141bce5

Browse files
committed
[Support] Do not use llvm::size in getLoopPreheader
There's no reason to require random access on downstream clients here. (cherry picked from commit 355f86e)
1 parent 0a1c903 commit 141bce5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/include/llvm/Support/GenericLoopInfoImpl.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,10 @@ BlockT *LoopBase<BlockT, LoopT>::getLoopPreheader() const {
208208
return nullptr;
209209

210210
// Make sure there is only one exit out of the preheader.
211-
if (llvm::size(llvm::children<BlockT *>(Out)) != 1)
211+
typedef GraphTraits<BlockT *> BlockTraits;
212+
typename BlockTraits::ChildIteratorType SI = BlockTraits::child_begin(Out);
213+
++SI;
214+
if (SI != BlockTraits::child_end(Out))
212215
return nullptr; // Multiple exits from the block, must not be a preheader.
213216

214217
// The predecessor has exactly one successor, so it is a preheader.

0 commit comments

Comments
 (0)