[Mlir-commits] [mlir] 171850c - [mlir][Vector] Drop use of FuncOp in transferOpflowOpt
River Riddle
llvmlistbot at llvm.org
Tue Mar 8 12:29:01 PST 2022
Author: River Riddle
Date: 2022-03-08T12:25:32-08:00
New Revision: 171850c55aaea3044a98aa573b747d4f7d9f4ea1
URL: https://github.com/llvm/llvm-project/commit/171850c55aaea3044a98aa573b747d4f7d9f4ea1
DIFF: https://github.com/llvm/llvm-project/commit/171850c55aaea3044a98aa573b747d4f7d9f4ea1.diff
LOG: [mlir][Vector] Drop use of FuncOp in transferOpflowOpt
FuncOp isn't really important to hardcode here, it is only used to act
as a root operation for the transformation.
Differential Revision: https://reviews.llvm.org/D121195
Added:
Modified:
mlir/include/mlir/Dialect/Vector/Transforms/VectorTransforms.h
mlir/lib/Dialect/Vector/Transforms/VectorTransferOpTransforms.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/Vector/Transforms/VectorTransforms.h b/mlir/include/mlir/Dialect/Vector/Transforms/VectorTransforms.h
index 4c2d9a1cedf4b..3bb9a22caf69e 100644
--- a/mlir/include/mlir/Dialect/Vector/Transforms/VectorTransforms.h
+++ b/mlir/include/mlir/Dialect/Vector/Transforms/VectorTransforms.h
@@ -89,7 +89,7 @@ distributPointwiseVectorOp(OpBuilder &builder, Operation *op,
/// Implements transfer op write to read forwarding and dead transfer write
/// optimizations.
-void transferOpflowOpt(FuncOp func);
+void transferOpflowOpt(Operation *rootOp);
} // namespace vector
} // namespace mlir
diff --git a/mlir/lib/Dialect/Vector/Transforms/VectorTransferOpTransforms.cpp b/mlir/lib/Dialect/Vector/Transforms/VectorTransferOpTransforms.cpp
index 2092d93f3ece1..931574641b752 100644
--- a/mlir/lib/Dialect/Vector/Transforms/VectorTransferOpTransforms.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/VectorTransferOpTransforms.cpp
@@ -40,7 +40,7 @@ namespace {
class TransferOptimization {
public:
- TransferOptimization(FuncOp func) : dominators(func), postDominators(func) {}
+ TransferOptimization(Operation *op) : dominators(op), postDominators(op) {}
void deadStoreOp(vector::TransferWriteOp);
void storeToLoadForwarding(vector::TransferReadOp);
void removeDeadOp() {
@@ -462,16 +462,16 @@ class FlattenContiguousRowMajorTransferWritePattern
} // namespace
-void mlir::vector::transferOpflowOpt(FuncOp func) {
- TransferOptimization opt(func);
+void mlir::vector::transferOpflowOpt(Operation *rootOp) {
+ TransferOptimization opt(rootOp);
// Run store to load forwarding first since it can expose more dead store
// opportunity.
- func.walk([&](vector::TransferReadOp read) {
+ rootOp->walk([&](vector::TransferReadOp read) {
if (read.getShapedType().isa<MemRefType>())
opt.storeToLoadForwarding(read);
});
opt.removeDeadOp();
- func.walk([&](vector::TransferWriteOp write) {
+ rootOp->walk([&](vector::TransferWriteOp write) {
if (write.getShapedType().isa<MemRefType>())
opt.deadStoreOp(write);
});
More information about the Mlir-commits
mailing list