Skip to content

[mlir] Use llvm::all_of (NFC) #140464

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

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
18 changes: 8 additions & 10 deletions mlir/lib/Conversion/OpenMPToLLVM/OpenMPToLLVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,14 @@ void mlir::configureOpenMPToLLVMConversionLegality(
>([&](Operation *op) {
return typeConverter.isLegal(op->getOperandTypes()) &&
typeConverter.isLegal(op->getResultTypes()) &&
std::all_of(op->getRegions().begin(), op->getRegions().end(),
[&](Region &region) {
return typeConverter.isLegal(&region);
}) &&
std::all_of(op->getAttrs().begin(), op->getAttrs().end(),
[&](NamedAttribute attr) {
auto typeAttr = dyn_cast<TypeAttr>(attr.getValue());
return !typeAttr ||
typeConverter.isLegal(typeAttr.getValue());
});
llvm::all_of(op->getRegions(),
[&](Region &region) {
return typeConverter.isLegal(&region);
}) &&
llvm::all_of(op->getAttrs(), [&](NamedAttribute attr) {
auto typeAttr = dyn_cast<TypeAttr>(attr.getValue());
return !typeAttr || typeConverter.isLegal(typeAttr.getValue());
});
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,9 @@ struct LoadStoreLikeOpRewriter : public OpRewritePattern<LoadStoreLikeOp> {
// to do.
SmallVector<OpFoldResult> indices =
getAsOpFoldResult(loadStoreLikeOp.getIndices());
if (std::all_of(indices.begin(), indices.end(),
[](const OpFoldResult &opFold) {
return isConstantIntValue(opFold, 0);
})) {
if (llvm::all_of(indices, [](const OpFoldResult &opFold) {
return isConstantIntValue(opFold, 0);
})) {
return rewriter.notifyMatchFailure(
loadStoreLikeOp, "no computation to extract: offsets are 0s");
}
Expand Down
5 changes: 2 additions & 3 deletions mlir/lib/Dialect/XeGPU/IR/XeGPUOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,8 @@ LogicalResult LoadNdOp::verify() {
auto trans = getTranspose().value();

// Make sure the transpose value is valid.
bool valid = std::all_of(trans.begin(), trans.end(), [&](int t) {
return t >= 0 && t < tdescTy.getRank();
});
bool valid = llvm::all_of(
trans, [&](int t) { return t >= 0 && t < tdescTy.getRank(); });

if (valid)
transpose(trans, tdescShape);
Expand Down