[PATCH] D77389: [MLIR] Don't insert YieldOp for non-void loop.for by default.

Alex Zinenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 3 07:29:57 PDT 2020


ftynse added inline comments.


================
Comment at: mlir/lib/Dialect/LoopOps/LoopOps.cpp:51
+  bodyRegion->push_back(new Block());
+  if (iterArgs.empty())
+    ForOp::ensureTerminator(*bodyRegion, *builder, result.location);
----------------
This looks like the constructed op will be invalid by construction if iterArgs is non-empty, due to the missing terminator. It may be fine as long as it is clear from the documentation that the caller is supposed to fix that. Alternatively, you can still create a terminator that returns iterArgs, which would give you a valid region, but will probably defy the purpose of this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77389





More information about the llvm-commits mailing list