Skip to content

Commit 1cf1c21

Browse files
[mlir] Strip away lambdas (NFC) (#143280)
We don't need lambdas here.
1 parent 9ea3972 commit 1cf1c21

File tree

4 files changed

+10
-18
lines changed

4 files changed

+10
-18
lines changed

mlir/lib/Dialect/Affine/Analysis/LoopAnalysis.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,7 @@ isVectorizableLoopBodyWithOpCond(AffineForOp loop,
402402
return !VectorType::isValidElementType(type);
403403
}))
404404
return true;
405-
return llvm::any_of(op.getResultTypes(), [](Type type) {
406-
return !VectorType::isValidElementType(type);
407-
});
405+
return !llvm::all_of(op.getResultTypes(), VectorType::isValidElementType);
408406
});
409407
SmallVector<NestedMatch, 8> opsMatched;
410408
types.match(forOp, &opsMatched);

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -820,9 +820,8 @@ tensorExtractVectorizationPrecondition(Operation *op, bool vectorizeNDExtract) {
820820
return failure();
821821
}
822822

823-
if (llvm::any_of(extractOp->getResultTypes(), [](Type type) {
824-
return !VectorType::isValidElementType(type);
825-
})) {
823+
if (!llvm::all_of(extractOp->getResultTypes(),
824+
VectorType::isValidElementType)) {
826825
return failure();
827826
}
828827

@@ -2287,14 +2286,12 @@ static LogicalResult vectorizeLinalgOpPrecondition(
22872286
})) {
22882287
continue;
22892288
}
2290-
if (llvm::any_of(innerOp.getOperandTypes(), [](Type type) {
2291-
return !VectorType::isValidElementType(type);
2292-
})) {
2289+
if (!llvm::all_of(innerOp.getOperandTypes(),
2290+
VectorType::isValidElementType)) {
22932291
return failure();
22942292
}
2295-
if (llvm::any_of(innerOp.getResultTypes(), [](Type type) {
2296-
return !VectorType::isValidElementType(type);
2297-
})) {
2293+
if (!llvm::all_of(innerOp.getResultTypes(),
2294+
VectorType::isValidElementType)) {
22982295
return failure();
22992296
}
23002297
}

mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -799,8 +799,7 @@ LogicalResult SparseTensorEncodingAttr::verify(
799799
"before singleton level";
800800

801801
auto *curCOOEnd = std::find_if_not(it, lvlTypes.end(), isSingletonLT);
802-
if (!std::all_of(it, curCOOEnd,
803-
[](LevelType i) { return isSingletonLT(i); }))
802+
if (!std::all_of(it, curCOOEnd, isSingletonLT))
804803
return emitError() << "expected all singleton lvlTypes "
805804
"following a singleton level";
806805
// We can potentially support mixed SoA/AoS singleton levels.
@@ -833,8 +832,7 @@ LogicalResult SparseTensorEncodingAttr::verify(
833832
it != std::end(lvlTypes)) {
834833
if (it != lvlTypes.end() - 1)
835834
return emitError() << "expected n_out_of_m to be the last level type";
836-
if (!std::all_of(lvlTypes.begin(), it,
837-
[](LevelType i) { return isDenseLT(i); }))
835+
if (!std::all_of(lvlTypes.begin(), it, isDenseLT))
838836
return emitError() << "expected all dense lvlTypes "
839837
"before a n_out_of_m level";
840838
if (dimToLvl && (dimToLvl.getNumDims() != dimToLvl.getNumResults())) {

mlir/lib/Dialect/Tensor/IR/TensorOps.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,8 +1061,7 @@ void DimOp::getCanonicalizationPatterns(RewritePatternSet &results,
10611061
void EmptyOp::build(OpBuilder &builder, OperationState &result,
10621062
ArrayRef<int64_t> staticShape, Type elementType,
10631063
Attribute encoding) {
1064-
assert(all_of(staticShape,
1065-
[](int64_t sz) { return !ShapedType::isDynamic(sz); }) &&
1064+
assert(none_of(staticShape, ShapedType::isDynamic) &&
10661065
"expected only static sizes");
10671066
build(builder, result, staticShape, elementType, ValueRange{}, encoding);
10681067
}

0 commit comments

Comments
 (0)