[Mlir-commits] [mlir] 76f7e4b - [mlir][SCF][bufferize][NFC] Utilize recently added helper function
Matthias Springer
llvmlistbot at llvm.org
Thu Jun 30 00:55:00 PDT 2022
Author: Matthias Springer
Date: 2022-06-30T09:54:52+02:00
New Revision: 76f7e4b7a3d98e8f329953f7eab2b2e1ccac034e
URL: https://github.com/llvm/llvm-project/commit/76f7e4b7a3d98e8f329953f7eab2b2e1ccac034e
DIFF: https://github.com/llvm/llvm-project/commit/76f7e4b7a3d98e8f329953f7eab2b2e1ccac034e.diff
LOG: [mlir][SCF][bufferize][NFC] Utilize recently added helper function
This should have been part of D128666.
Differential Revision: https://reviews.llvm.org/D128885
Added:
Modified:
mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
Removed:
################################################################################
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<ForeachThreadOp>();
- 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<ParallelInsertSliceOp>()) {
- if (insertOp.getOperation() == op)
- break;
- ++opIdx;
- }
- assert(opIdx < foreachThreadOp->getNumResults() &&
- "could not find op inside terminator op");
-
- return {foreachThreadOp->getResult(opIdx)};
+ auto insertOp = cast<ParallelInsertSliceOp>(op);
+ return {insertOp.getTiedOpResult()};
}
bool bufferizesToMemoryRead(Operation *op, OpOperand &opOperand,
More information about the Mlir-commits
mailing list