Verify IslandOp body has no block arguments
Also, removed explicit check on empty body which is already verified by trait SingleBlockImplicitTerminator. PiperOrigin-RevId: 322222883 Change-Id: Id9344905328a5680a02b8c95fe2805e230780e77
This commit is contained in:
parent
365edbfd59
commit
b7fb764f9f
@ -301,8 +301,8 @@ bool IslandOp::WrapsSingleOp() {
|
||||
namespace {
|
||||
|
||||
LogicalResult Verify(IslandOp island) {
|
||||
if (island.GetBody().empty())
|
||||
return island.emitOpError() << "expects a non-empty body";
|
||||
if (!island.GetBody().args_empty())
|
||||
return island.emitOpError() << "expects body without any arguments";
|
||||
|
||||
Operation &yield = island.GetBody().back();
|
||||
if (!isa<YieldOp>(yield))
|
||||
|
@ -232,6 +232,20 @@ func @invalid_island(%arg0: tensor<*xf32>, %ctl: !tf_executor.control) {
|
||||
|
||||
// -----
|
||||
|
||||
// Check that an island body doesn't have any block arguments.
|
||||
func @invalid_island(%arg0: tensor<*xf32>, %ctl: !tf_executor.control) {
|
||||
tf_executor.graph {
|
||||
"tf_executor.island"() ({
|
||||
// expected-error@-1 {{expects body without any arguments}}
|
||||
^entry(%arg: tensor<2xi32>):
|
||||
tf_executor.yield
|
||||
}) : () -> (!tf_executor.control)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
// Check that an island body can't be empty.
|
||||
func @invalid_island(%arg0: tensor<*xf32>, %ctl: !tf_executor.control) {
|
||||
tf_executor.graph {
|
||||
|
Loading…
x
Reference in New Issue
Block a user