[Mlir-commits] [mlir] [MLIR][Bufferizer][NFC] Simplify some codes. (PR #77254)
Javed Absar
llvmlistbot at llvm.org
Sun Jan 7 12:44:38 PST 2024
https://github.com/javedabsar1 created https://github.com/llvm/llvm-project/pull/77254
NFC. clean up.
>From f79452f7543462eb4f95e898d841489aa70d32a7 Mon Sep 17 00:00:00 2001
From: mabsar <javed.absar at gmail.com>
Date: Sun, 7 Jan 2024 14:19:55 -0500
Subject: [PATCH] [MLIR][Bufferizer][NFC] Simplify some codes. Some cleanup
---
.../Bufferization/Transforms/BufferViewFlowAnalysis.cpp | 2 +-
.../Bufferization/Transforms/EmptyTensorElimination.cpp | 7 +++----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/BufferViewFlowAnalysis.cpp b/mlir/lib/Dialect/Bufferization/Transforms/BufferViewFlowAnalysis.cpp
index 98a60a48763ab1..943d96b9d542ab 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..78b70114fabd12 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