Checks if a tf_device.launch wraps a single operation and the single operation results are perfectly forwarded to the launch return.
| 106 | // Checks if a tf_device.launch wraps a single operation and the single |
| 107 | // operation results are perfectly forwarded to the launch return. |
| 108 | bool LaunchOp::WrapsSingleOp() { |
| 109 | auto body = GetBody().without_terminator(); |
| 110 | if (!has_single_element(body)) return false; |
| 111 | |
| 112 | Operation& wrapped_op = *body.begin(); |
| 113 | Operation* terminator = GetBody().getTerminator(); |
| 114 | return wrapped_op.getNumResults() == terminator->getNumOperands() && |
| 115 | std::equal(wrapped_op.getResults().begin(), |
| 116 | wrapped_op.getResults().end(), |
| 117 | terminator->getOperands().begin()); |
| 118 | } |
| 119 | |
| 120 | //===----------------------------------------------------------------------===// |
| 121 | // tf_device.return |
no test coverage detected