[Mlir-commits] [mlir] [MLIR][Bufferizer][NFC] Simplify some codes. (PR #77254)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun Jan 7 12:45:05 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Javed Absar (javedabsar1)

<details>
<summary>Changes</summary>

NFC. clean up.

---
Full diff: https://github.com/llvm/llvm-project/pull/77254.diff


2 Files Affected:

- (modified) mlir/lib/Dialect/Bufferization/Transforms/BufferViewFlowAnalysis.cpp (+1-1) 
- (modified) mlir/lib/Dialect/Bufferization/Transforms/EmptyTensorElimination.cpp (+3-4) 


``````````diff
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

``````````

</details>


https://github.com/llvm/llvm-project/pull/77254


More information about the Mlir-commits mailing list