[llvm] [Support] Do not use `llvm::size` in `getLoopPreheader` (PR #94540)
Ben Barham via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 7 21:10:35 PDT 2024
================
@@ -208,7 +208,10 @@ BlockT *LoopBase<BlockT, LoopT>::getLoopPreheader() const {
return nullptr;
// Make sure there is only one exit out of the preheader.
- if (llvm::size(llvm::children<BlockT *>(Out)) != 1)
+ typedef GraphTraits<BlockT *> BlockTraits;
+ typename BlockTraits::ChildIteratorType SI = BlockTraits::child_begin(Out);
+ ++SI;
+ if (SI != BlockTraits::child_end(Out))
----------------
bnbarham wrote:
Ah nice, much better. Switched to `llvm::hasSingleElement`, thanks!
https://github.com/llvm/llvm-project/pull/94540
More information about the llvm-commits
mailing list