[mlir] Strip away lambdas (NFC) (#143280)

We don't need lambdas here.
This commit is contained in:
Kazu Hirata 2025-06-08 01:34:17 -07:00 committed by GitHub
parent 9ea3972cd1
commit 1cf1c21b84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 18 deletions

View File

@ -402,9 +402,7 @@ isVectorizableLoopBodyWithOpCond(AffineForOp loop,
return !VectorType::isValidElementType(type); return !VectorType::isValidElementType(type);
})) }))
return true; return true;
return llvm::any_of(op.getResultTypes(), [](Type type) { return !llvm::all_of(op.getResultTypes(), VectorType::isValidElementType);
return !VectorType::isValidElementType(type);
});
}); });
SmallVector<NestedMatch, 8> opsMatched; SmallVector<NestedMatch, 8> opsMatched;
types.match(forOp, &opsMatched); types.match(forOp, &opsMatched);

View File

@ -820,9 +820,8 @@ tensorExtractVectorizationPrecondition(Operation *op, bool vectorizeNDExtract) {
return failure(); return failure();
} }
if (llvm::any_of(extractOp->getResultTypes(), [](Type type) { if (!llvm::all_of(extractOp->getResultTypes(),
return !VectorType::isValidElementType(type); VectorType::isValidElementType)) {
})) {
return failure(); return failure();
} }
@ -2287,14 +2286,12 @@ static LogicalResult vectorizeLinalgOpPrecondition(
})) { })) {
continue; continue;
} }
if (llvm::any_of(innerOp.getOperandTypes(), [](Type type) { if (!llvm::all_of(innerOp.getOperandTypes(),
return !VectorType::isValidElementType(type); VectorType::isValidElementType)) {
})) {
return failure(); return failure();
} }
if (llvm::any_of(innerOp.getResultTypes(), [](Type type) { if (!llvm::all_of(innerOp.getResultTypes(),
return !VectorType::isValidElementType(type); VectorType::isValidElementType)) {
})) {
return failure(); return failure();
} }
} }

View File

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

View File

@ -1061,8 +1061,7 @@ void DimOp::getCanonicalizationPatterns(RewritePatternSet &results,
void EmptyOp::build(OpBuilder &builder, OperationState &result, void EmptyOp::build(OpBuilder &builder, OperationState &result,
ArrayRef<int64_t> staticShape, Type elementType, ArrayRef<int64_t> staticShape, Type elementType,
Attribute encoding) { Attribute encoding) {
assert(all_of(staticShape, assert(none_of(staticShape, ShapedType::isDynamic) &&
[](int64_t sz) { return !ShapedType::isDynamic(sz); }) &&
"expected only static sizes"); "expected only static sizes");
build(builder, result, staticShape, elementType, ValueRange{}, encoding); build(builder, result, staticShape, elementType, ValueRange{}, encoding);
} }