Skip to content

Commit 0ba868d

Browse files
authored
[MLIR][Bufferizer][NFC] Simplify some codes. (#77254)
NFC. clean up.
1 parent 442f67c commit 0ba868d

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

mlir/lib/Dialect/Bufferization/Transforms/BufferViewFlowAnalysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void BufferViewFlowAnalysis::rename(Value from, Value to) {
4949
dependencies[to] = dependencies[from];
5050
dependencies.erase(from);
5151

52-
for (auto &[key, value] : dependencies) {
52+
for (auto &[_, value] : dependencies) {
5353
if (value.contains(from)) {
5454
value.insert(to);
5555
value.erase(from);

mlir/lib/Dialect/Bufferization/Transforms/EmptyTensorElimination.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,9 @@ neededValuesDominateInsertionPoint(const DominanceInfo &domInfo,
5353
static bool insertionPointDominatesUses(const DominanceInfo &domInfo,
5454
Operation *insertionPoint,
5555
Operation *emptyTensorOp) {
56-
for (Operation *user : emptyTensorOp->getUsers())
57-
if (!domInfo.dominates(insertionPoint, user))
58-
return false;
59-
return true;
56+
return llvm::all_of(emptyTensorOp->getUsers(), [&](Operation *user) {
57+
return domInfo.dominates(insertionPoint, user);
58+
});
6059
}
6160

6261
/// Find a valid insertion point for a replacement of `emptyTensorOp`, assuming

0 commit comments

Comments
 (0)