Skip to content

Commit 6d515ce

Browse files
[mlir] Use llvm::all_of (NFC) (#140464)
1 parent c512d95 commit 6d515ce

File tree

3 files changed

+13
-17
lines changed

3 files changed

+13
-17
lines changed

mlir/lib/Conversion/OpenMPToLLVM/OpenMPToLLVM.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,14 @@ void mlir::configureOpenMPToLLVMConversionLegality(
115115
>([&](Operation *op) {
116116
return typeConverter.isLegal(op->getOperandTypes()) &&
117117
typeConverter.isLegal(op->getResultTypes()) &&
118-
std::all_of(op->getRegions().begin(), op->getRegions().end(),
119-
[&](Region &region) {
120-
return typeConverter.isLegal(&region);
121-
}) &&
122-
std::all_of(op->getAttrs().begin(), op->getAttrs().end(),
123-
[&](NamedAttribute attr) {
124-
auto typeAttr = dyn_cast<TypeAttr>(attr.getValue());
125-
return !typeAttr ||
126-
typeConverter.isLegal(typeAttr.getValue());
127-
});
118+
llvm::all_of(op->getRegions(),
119+
[&](Region &region) {
120+
return typeConverter.isLegal(&region);
121+
}) &&
122+
llvm::all_of(op->getAttrs(), [&](NamedAttribute attr) {
123+
auto typeAttr = dyn_cast<TypeAttr>(attr.getValue());
124+
return !typeAttr || typeConverter.isLegal(typeAttr.getValue());
125+
});
128126
});
129127
}
130128

mlir/lib/Dialect/MemRef/Transforms/ExtractAddressComputations.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,9 @@ struct LoadStoreLikeOpRewriter : public OpRewritePattern<LoadStoreLikeOp> {
251251
// to do.
252252
SmallVector<OpFoldResult> indices =
253253
getAsOpFoldResult(loadStoreLikeOp.getIndices());
254-
if (std::all_of(indices.begin(), indices.end(),
255-
[](const OpFoldResult &opFold) {
256-
return isConstantIntValue(opFold, 0);
257-
})) {
254+
if (llvm::all_of(indices, [](const OpFoldResult &opFold) {
255+
return isConstantIntValue(opFold, 0);
256+
})) {
258257
return rewriter.notifyMatchFailure(
259258
loadStoreLikeOp, "no computation to extract: offsets are 0s");
260259
}

mlir/lib/Dialect/XeGPU/IR/XeGPUOps.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,8 @@ LogicalResult LoadNdOp::verify() {
312312
auto trans = getTranspose().value();
313313

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

319318
if (valid)
320319
transpose(trans, tdescShape);

0 commit comments

Comments
 (0)