diff --git a/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp index 1f6359bfbb497..09bd37cd85d38 100644 --- a/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp +++ b/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp @@ -1045,24 +1045,8 @@ struct ParallelInsertSliceOpInterface // ParallelInsertSliceOp itself has no results. Tensors are returned via // the parent op. - auto foreachThreadOp = op->getParentOfType(); - assert(foreachThreadOp && - "could not find valid owner of parallel_insert_slice"); - - // The i-th ParallelInsertSliceOp result is returned via the i-th OpResult - // of the parent ForeachThreadOp. - Block *block = op->getBlock(); - unsigned int opIdx = 0; - for (ParallelInsertSliceOp insertOp : - block->getOps()) { - if (insertOp.getOperation() == op) - break; - ++opIdx; - } - assert(opIdx < foreachThreadOp->getNumResults() && - "could not find op inside terminator op"); - - return {foreachThreadOp->getResult(opIdx)}; + auto insertOp = cast(op); + return {insertOp.getTiedOpResult()}; } bool bufferizesToMemoryRead(Operation *op, OpOperand &opOperand,