[llvm] [Support] Do not use `llvm::size` in `getLoopPreheader` (PR #94540)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 5 21:49:21 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))
----------------
kazutakahirata wrote:
Could we do something like this?
```suggestion
if (!llvm::hasSingleElement(GraphTraits<BlockT *>::children(Out)))
```
https://github.com/llvm/llvm-project/pull/94540
More information about the llvm-commits
mailing list