[Mlir-commits] [mlir] 0ba868d - [MLIR][Bufferizer][NFC] Simplify some codes. (#77254)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Jan 8 01:38:01 PST 2024
Author: Javed Absar
Date: 2024-01-08T09:37:57Z
New Revision: 0ba868db709d2822b00f4ee9552d7fe41e5f2722
URL: https://github.com/llvm/llvm-project/commit/0ba868db709d2822b00f4ee9552d7fe41e5f2722
DIFF: https://github.com/llvm/llvm-project/commit/0ba868db709d2822b00f4ee9552d7fe41e5f2722.diff
LOG: [MLIR][Bufferizer][NFC] Simplify some codes. (#77254)
NFC. clean up.
Added:
Modified:
mlir/lib/Dialect/Bufferization/Transforms/BufferViewFlowAnalysis.cpp
mlir/lib/Dialect/Bufferization/Transforms/EmptyTensorElimination.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/BufferViewFlowAnalysis.cpp b/mlir/lib/Dialect/Bufferization/Transforms/BufferViewFlowAnalysis.cpp
index 98a60a48763ab1..88ef1b639fc5ce 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/BufferViewFlowAnalysis.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/BufferViewFlowAnalysis.cpp
@@ -49,7 +49,7 @@ void BufferViewFlowAnalysis::rename(Value from, Value to) {
dependencies[to] = dependencies[from];
dependencies.erase(from);
- for (auto &[key, value] : dependencies) {
+ for (auto &[_, value] : dependencies) {
if (value.contains(from)) {
value.insert(to);
value.erase(from);
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/EmptyTensorElimination.cpp b/mlir/lib/Dialect/Bufferization/Transforms/EmptyTensorElimination.cpp
index 4a418a05e6ff56..eba1273b36e242 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/EmptyTensorElimination.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/EmptyTensorElimination.cpp
@@ -53,10 +53,9 @@ neededValuesDominateInsertionPoint(const DominanceInfo &domInfo,
static bool insertionPointDominatesUses(const DominanceInfo &domInfo,
Operation *insertionPoint,
Operation *emptyTensorOp) {
- for (Operation *user : emptyTensorOp->getUsers())
- if (!domInfo.dominates(insertionPoint, user))
- return false;
- return true;
+ return llvm::all_of(emptyTensorOp->getUsers(), [&](Operation *user) {
+ return domInfo.dominates(insertionPoint, user);
+ });
}
/// Find a valid insertion point for a replacement of `emptyTensorOp`, assuming
More information about the Mlir-commits
mailing list