Make mlir::isPerfectlyNested more efficient; use O(1) check instead of
O(N) size() method.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Transforms/Utils/LoopUtils.cpp | ||
---|---|---|
715 | nit: You could use llvm::hasNItems(block->begin(), block->end(), 2). We could also add a range based version to make it more usable. |
mlir/lib/Transforms/Utils/LoopUtils.cpp | ||
---|---|---|
715 | This would lead to one extra conditional check since it wouldn't factor in the additional information that this block is known to have at least one element. But that method is useful in general - thanks. |
nit: You could use llvm::hasNItems(block->begin(), block->end(), 2). We could also add a range based version to make it more usable.