[MLIR] Don't insert YieldOp for non-void loop.for by default.
authorAlexander Belyaev <pifon@google.com>
Fri, 3 Apr 2020 15:57:41 +0000 (17:57 +0200)
committerAlexander Belyaev <pifon@google.com>
Sun, 5 Apr 2020 09:48:22 +0000 (11:48 +0200)
commit51e3709c2b9055fe9e6fc83fc7f056bd55b2aaa6
tree69bb424416d5b56cb718bb17f17db4024519e1b3
parent0359b86d8bb24a7bcd37dc6126baee303bc6c939
[MLIR] Don't insert YieldOp for non-void loop.for by default.

The ForOp::build ensures that there is a block terminator which is great for
the default use case when there are no iter_args and loop.for returns no
results.  In non-zero results case we always need to call replaceOpWithNewOp
which is not the nicest thing in the world. We can stop inserting YieldOp when
iter_args is non-empty. IfOp::build already behaves similarly.
mlir/include/mlir/Dialect/LoopOps/LoopOps.td
mlir/lib/Conversion/LoopToStandard/LoopToStandard.cpp
mlir/lib/Dialect/LoopOps/LoopOps.cpp