[Mlir-commits] [mlir] [mlir] Use llvm::is_contained (NFC) (PR #140012)
Kazu Hirata
llvmlistbot at llvm.org
Wed May 14 23:48:37 PDT 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/140012
None
>From 73e2c38d068506a98609d68586e2e54b8c07c079 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Tue, 13 May 2025 21:12:27 -0700
Subject: [PATCH] [mlir] Use llvm::is_contained (NFC)
---
mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp | 4 ++--
mlir/lib/Dialect/Mesh/IR/MeshOps.cpp | 2 +-
mlir/lib/Dialect/Quant/IR/QuantOps.cpp | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp b/mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp
index 0cc840403a020..e8d460020cf69 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp
@@ -511,7 +511,7 @@ struct LinalgOpPartialReductionInterface
for (auto [resultNum, dimExpr] :
llvm::enumerate(partialMap.getResults())) {
unsigned dim = cast<AffineDimExpr>(dimExpr).getPosition();
- if (llvm::find(reductionDims, dim) != reductionDims.end()) {
+ if (llvm::is_contained(reductionDims, dim)) {
partialReductionDims.push_back(resultNum);
}
}
@@ -553,7 +553,7 @@ struct LinalgOpPartialReductionInterface
unsigned dim = cast<AffineDimExpr>(dimExpr).getPosition();
resultSizes.push_back(sizes[dim]);
- if (llvm::find(reductionDims, dim) != reductionDims.end()) {
+ if (llvm::is_contained(reductionDims, dim)) {
// Reduction dims are reduced, and are always outputed in the same
// place. So use offset 0 for them.
resultOffsets.push_back(b.getIndexAttr(0));
diff --git a/mlir/lib/Dialect/Mesh/IR/MeshOps.cpp b/mlir/lib/Dialect/Mesh/IR/MeshOps.cpp
index 1a1334f0ea474..2bdb58892937f 100644
--- a/mlir/lib/Dialect/Mesh/IR/MeshOps.cpp
+++ b/mlir/lib/Dialect/Mesh/IR/MeshOps.cpp
@@ -1505,7 +1505,7 @@ LogicalResult ShiftOp::verifySymbolUses(SymbolTableCollection &symbolTable) {
auto meshAxes = getMeshAxes();
auto shiftAxis = getShiftAxis().getZExtValue();
- if (llvm::find(meshAxes, shiftAxis) == meshAxes.end()) {
+ if (!llvm::is_contained(meshAxes, shiftAxis)) {
return emitError() << "Invalid shift axis " << shiftAxis
<< ". It must be one of the grouping mesh axes.";
}
diff --git a/mlir/lib/Dialect/Quant/IR/QuantOps.cpp b/mlir/lib/Dialect/Quant/IR/QuantOps.cpp
index 94e1c8b8ba296..e23a0d6aba825 100644
--- a/mlir/lib/Dialect/Quant/IR/QuantOps.cpp
+++ b/mlir/lib/Dialect/Quant/IR/QuantOps.cpp
@@ -122,7 +122,7 @@ LogicalResult verifySubChannelQuantization(
//
// Therefore, we explicitly disallow the case where d = 0 to maintain
// consistency and avoid these issues.
- if (llvm::find(tensorType.getShape(), 0) != tensorType.getShape().end()) {
+ if (llvm::is_contained(tensorType.getShape(), 0)) {
return op->emitError() << "tensor dimension size of zero is not allowed "
"with sub-channel quantization";
}
More information about the Mlir-commits
mailing list