[Mlir-commits] [mlir] [mlir] Remove redundant control flow statements (NFC) (PR #141184)
Kazu Hirata
llvmlistbot at llvm.org
Thu May 22 19:17:57 PDT 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/141184
None
>From ede37d177c957778c67cd9b914bdf266f122b0fe Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 21 May 2025 20:08:01 -0700
Subject: [PATCH] [mlir] Remove redundant control flow statements (NFC)
---
mlir/include/mlir/Analysis/DataFlow/DenseAnalysis.h | 4 ++--
mlir/include/mlir/Analysis/DataFlowFramework.h | 2 +-
mlir/lib/Dialect/Mesh/IR/MeshOps.cpp | 1 -
mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp | 1 -
.../lib/Dialect/Linalg/TestLinalgRankReduceContractionOps.cpp | 1 -
5 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/mlir/include/mlir/Analysis/DataFlow/DenseAnalysis.h b/mlir/include/mlir/Analysis/DataFlow/DenseAnalysis.h
index 7ecde7f39415c..8bcfe51ad7cd1 100644
--- a/mlir/include/mlir/Analysis/DataFlow/DenseAnalysis.h
+++ b/mlir/include/mlir/Analysis/DataFlow/DenseAnalysis.h
@@ -125,7 +125,7 @@ class AbstractDenseForwardDataFlowAnalysis : public DataFlowAnalysis {
/// Visit an operation. If this analysis can confirm that lattice content
/// of lattice anchors around operation are necessarily identical, join
/// them into the same equivalent class.
- virtual void buildOperationEquivalentLatticeAnchor(Operation *op) { return; }
+ virtual void buildOperationEquivalentLatticeAnchor(Operation *op) {}
/// Propagate the dense lattice forward along the control flow edge from
/// `regionFrom` to `regionTo` regions of the `branch` operation. `nullopt`
@@ -386,7 +386,7 @@ class AbstractDenseBackwardDataFlowAnalysis : public DataFlowAnalysis {
/// Visit an operation. If this analysis can confirm that lattice content
/// of lattice anchors around operation are necessarily identical, join
/// them into the same equivalent class.
- virtual void buildOperationEquivalentLatticeAnchor(Operation *op) { return; }
+ virtual void buildOperationEquivalentLatticeAnchor(Operation *op) {}
/// Propagate the dense lattice backwards along the control flow edge from
/// `regionFrom` to `regionTo` regions of the `branch` operation. `nullopt`
diff --git a/mlir/include/mlir/Analysis/DataFlowFramework.h b/mlir/include/mlir/Analysis/DataFlowFramework.h
index caf978a51fd8e..49862927caff2 100644
--- a/mlir/include/mlir/Analysis/DataFlowFramework.h
+++ b/mlir/include/mlir/Analysis/DataFlowFramework.h
@@ -622,7 +622,7 @@ class DataFlowAnalysis {
/// This function will union lattice anchor to same equivalent class if the
/// analysis can determine the lattice content of lattice anchor is
/// necessarily identical under the corrensponding lattice type.
- virtual void initializeEquivalentLatticeAnchor(Operation *top) { return; }
+ virtual void initializeEquivalentLatticeAnchor(Operation *top) {}
protected:
/// Create a dependency between the given analysis state and lattice anchor
diff --git a/mlir/lib/Dialect/Mesh/IR/MeshOps.cpp b/mlir/lib/Dialect/Mesh/IR/MeshOps.cpp
index 2bdb58892937f..304cb55a35086 100644
--- a/mlir/lib/Dialect/Mesh/IR/MeshOps.cpp
+++ b/mlir/lib/Dialect/Mesh/IR/MeshOps.cpp
@@ -314,7 +314,6 @@ void mlir::mesh::maybeInsertTargetShardingAnnotation(MeshSharding sharding,
newShardOp.getSharding(),
/*annotate_for_users*/ true);
rewriter.replaceAllUsesExcept(newShardOp, newShardOp2, newShardOp2);
- return;
}
void mlir::mesh::maybeInsertTargetShardingAnnotation(MeshSharding sharding,
diff --git a/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp b/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
index 9227b0f8fd5b9..f9db5dcb88b4c 100644
--- a/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
+++ b/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
@@ -463,7 +463,6 @@ struct TosaValidation : public tosa::impl::TosaValidationBase<TosaValidation> {
depth++;
getMaxNestedDepth(op, depth);
- return;
}
bool levelCheckMaxNesting(Operation *op) {
diff --git a/mlir/test/lib/Dialect/Linalg/TestLinalgRankReduceContractionOps.cpp b/mlir/test/lib/Dialect/Linalg/TestLinalgRankReduceContractionOps.cpp
index 750ba6b5d9872..d7b7c6fe90c90 100644
--- a/mlir/test/lib/Dialect/Linalg/TestLinalgRankReduceContractionOps.cpp
+++ b/mlir/test/lib/Dialect/Linalg/TestLinalgRankReduceContractionOps.cpp
@@ -51,7 +51,6 @@ struct TestLinalgRankReduceContractionOps
linalg::populateContractionOpRankReducingPatterns(patterns);
if (failed(applyPatternsGreedily(funcOp.getBody(), std::move(patterns))))
return signalPassFailure();
- return;
}
};
More information about the Mlir-commits
mailing list