Skip to content

Commit ce8cf32

Browse files
[mlir] Strip away lambdas (NFC)
We don't need lambdas here.
1 parent fe3760e commit ce8cf32

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

@@ -2163,14 +2162,12 @@ static LogicalResult vectorizeLinalgOpPrecondition(
21632162
})) {
21642163
continue;
21652164
}
2166-
if (llvm::any_of(innerOp.getOperandTypes(), [](Type type) {
2167-
return !VectorType::isValidElementType(type);
2168-
})) {
2165+
if (!llvm::all_of(innerOp.getOperandTypes(),
2166+
VectorType::isValidElementType)) {
21692167
return failure();
21702168
}
2171-
if (llvm::any_of(innerOp.getResultTypes(), [](Type type) {
2172-
return !VectorType::isValidElementType(type);
2173-
})) {
2169+
if (!llvm::all_of(innerOp.getResultTypes(),
2170+
VectorType::isValidElementType)) {
21742171
return failure();
21752172
}
21762173
}

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)