[PATCH] D78428: [MLIR] Make isPerfectlyNested check more efficient

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 18 11:17:53 PDT 2020


rriddle added inline comments.


================
Comment at: mlir/lib/Transforms/Utils/LoopUtils.cpp:715
+  // We already know that the block can't be empty.
+  auto hasTwoElements = [](Block *block) {
+    auto secondOpIt = std::next(block->begin());
----------------
nit: You could use `llvm::hasNItems(block->begin(), block->end(), 2)`. We could also add a range based version to make it more usable.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78428/new/

https://reviews.llvm.org/D78428





More information about the llvm-commits mailing list