Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mlir] Use llvm::is_contained (NFC) #102714

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mlir/lib/Analysis/Presburger/Barvinok.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ mlir::presburger::detail::computePolytopeGeneratingFunction(

if (!vertex)
continue;
if (std::find(vertices.begin(), vertices.end(), vertex) != vertices.end())
if (llvm::is_contained(vertices, vertex))
continue;
// If this subset corresponds to a vertex that has not been considered,
// store it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -725,8 +725,7 @@ projectDimsPosIntoReassocPos(ArrayRef<int64_t> dimsPos,
// If the dimension is present in the current indices group, the group
// position within the reassociation map is the desired projected
// dimension position.
if (llvm::any_of(indices,
[&](int64_t expandDim) { return expandDim == pos; })) {
if (llvm::is_contained(indices, pos)) {
projectedPos.push_back(idx);
break;
}
Expand Down
4 changes: 1 addition & 3 deletions mlir/lib/Dialect/Linalg/Transforms/Specialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,7 @@ static FailureOr<LinalgOp> specializeLinalgContractions(RewriterBase &rewriter,
auto c =
matchOperandMap(indexingMaps[2], numOfBatchDims, dims.m[0], dims.n[0]);

if (llvm::any_of(ArrayRef<IndexMatchResult>{a, b, c}, [](IndexMatchResult r) {
return r == IndexMatchResult::Mismatch;
}))
if (llvm::is_contained({a, b, c}, IndexMatchResult::Mismatch))
return failure();

if (c != IndexMatchResult::Match ||
Expand Down
3 changes: 1 addition & 2 deletions mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -838,8 +838,7 @@ struct FoldEmptyCopy final : public OpRewritePattern<CopyOp> {
using OpRewritePattern<CopyOp>::OpRewritePattern;

static bool isEmptyMemRef(BaseMemRefType type) {
return type.hasRank() &&
llvm::any_of(type.getShape(), [](int64_t x) { return x == 0; });
return type.hasRank() && llvm::is_contained(type.getShape(), 0);
}

LogicalResult matchAndRewrite(CopyOp copyOp,
Expand Down
6 changes: 2 additions & 4 deletions mlir/lib/Dialect/MemRef/Transforms/EmulateNarrowType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ convertCastingOp(ConversionPatternRewriter &rewriter,
auto sizes = op.getStaticSizes();
int64_t offset = op.getStaticOffset(0);
// Only support static sizes and offsets.
if (llvm::any_of(sizes,
[](int64_t size) { return size == ShapedType::kDynamic; }) ||
if (llvm::is_contained(sizes, ShapedType::kDynamic) ||
offset == ShapedType::kDynamic) {
return rewriter.notifyMatchFailure(
op, "dynamic size or offset is not supported");
Expand Down Expand Up @@ -436,8 +435,7 @@ struct ConvertMemRefSubview final : OpConversionPattern<memref::SubViewOp> {
auto sizes = subViewOp.getStaticSizes();
int64_t lastOffset = subViewOp.getStaticOffsets().back();
// Only support static sizes and offsets.
if (llvm::any_of(
sizes, [](int64_t size) { return size == ShapedType::kDynamic; }) ||
if (llvm::is_contained(sizes, ShapedType::kDynamic) ||
lastOffset == ShapedType::kDynamic) {
return rewriter.notifyMatchFailure(
subViewOp->getLoc(), "dynamic size or offset is not supported");
Expand Down
Loading