Skip to content

Commit 165f453

Browse files
[mlir] Use llvm::is_contained (NFC) (#102714)
1 parent fcf6dc3 commit 165f453

File tree

5 files changed

+6
-12
lines changed

5 files changed

+6
-12
lines changed

mlir/lib/Analysis/Presburger/Barvinok.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ mlir::presburger::detail::computePolytopeGeneratingFunction(
357357

358358
if (!vertex)
359359
continue;
360-
if (std::find(vertices.begin(), vertices.end(), vertex) != vertices.end())
360+
if (llvm::is_contained(vertices, vertex))
361361
continue;
362362
// If this subset corresponds to a vertex that has not been considered,
363363
// store it.

mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,8 +725,7 @@ projectDimsPosIntoReassocPos(ArrayRef<int64_t> dimsPos,
725725
// If the dimension is present in the current indices group, the group
726726
// position within the reassociation map is the desired projected
727727
// dimension position.
728-
if (llvm::any_of(indices,
729-
[&](int64_t expandDim) { return expandDim == pos; })) {
728+
if (llvm::is_contained(indices, pos)) {
730729
projectedPos.push_back(idx);
731730
break;
732731
}

mlir/lib/Dialect/Linalg/Transforms/Specialize.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,7 @@ static FailureOr<LinalgOp> specializeLinalgContractions(RewriterBase &rewriter,
227227
auto c =
228228
matchOperandMap(indexingMaps[2], numOfBatchDims, dims.m[0], dims.n[0]);
229229

230-
if (llvm::any_of(ArrayRef<IndexMatchResult>{a, b, c}, [](IndexMatchResult r) {
231-
return r == IndexMatchResult::Mismatch;
232-
}))
230+
if (llvm::is_contained({a, b, c}, IndexMatchResult::Mismatch))
233231
return failure();
234232

235233
if (c != IndexMatchResult::Match ||

mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -838,8 +838,7 @@ struct FoldEmptyCopy final : public OpRewritePattern<CopyOp> {
838838
using OpRewritePattern<CopyOp>::OpRewritePattern;
839839

840840
static bool isEmptyMemRef(BaseMemRefType type) {
841-
return type.hasRank() &&
842-
llvm::any_of(type.getShape(), [](int64_t x) { return x == 0; });
841+
return type.hasRank() && llvm::is_contained(type.getShape(), 0);
843842
}
844843

845844
LogicalResult matchAndRewrite(CopyOp copyOp,

mlir/lib/Dialect/MemRef/Transforms/EmulateNarrowType.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ convertCastingOp(ConversionPatternRewriter &rewriter,
5858
auto sizes = op.getStaticSizes();
5959
int64_t offset = op.getStaticOffset(0);
6060
// Only support static sizes and offsets.
61-
if (llvm::any_of(sizes,
62-
[](int64_t size) { return size == ShapedType::kDynamic; }) ||
61+
if (llvm::is_contained(sizes, ShapedType::kDynamic) ||
6362
offset == ShapedType::kDynamic) {
6463
return rewriter.notifyMatchFailure(
6564
op, "dynamic size or offset is not supported");
@@ -436,8 +435,7 @@ struct ConvertMemRefSubview final : OpConversionPattern<memref::SubViewOp> {
436435
auto sizes = subViewOp.getStaticSizes();
437436
int64_t lastOffset = subViewOp.getStaticOffsets().back();
438437
// Only support static sizes and offsets.
439-
if (llvm::any_of(
440-
sizes, [](int64_t size) { return size == ShapedType::kDynamic; }) ||
438+
if (llvm::is_contained(sizes, ShapedType::kDynamic) ||
441439
lastOffset == ShapedType::kDynamic) {
442440
return rewriter.notifyMatchFailure(
443441
subViewOp->getLoc(), "dynamic size or offset is not supported");

0 commit comments

Comments
 (0)