Skip to content

Commit 79f313a

Browse files
kuharmgehre-amd
authored andcommitted
(Partial backport) [mlir][NFC] Simplify type checks with isa predicates (llvm#87183)
For more context on isa predicates, see: llvm#83753.
1 parent ac88769 commit 79f313a

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

mlir/lib/Dialect/EmitC/IR/EmitC.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,7 @@ LogicalResult emitc::CallOpaqueOp::verify() {
262262
}
263263
}
264264

265-
if (llvm::any_of(getResultTypes(),
266-
[](Type type) { return isa<ArrayType>(type); })) {
265+
if (llvm::any_of(getResultTypes(), llvm::IsaPred<ArrayType>)) {
267266
return emitOpError() << "cannot return array type";
268267
}
269268

mlir/lib/Target/Cpp/TranslateToCpp.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,8 +1016,7 @@ static LogicalResult printOperation(CppEmitter &emitter,
10161016
"with multiple blocks needs variables declared at top");
10171017
}
10181018

1019-
if (llvm::any_of(functionOp.getResultTypes(),
1020-
[](Type type) { return isa<ArrayType>(type); })) {
1019+
if (llvm::any_of(functionOp.getResultTypes(), llvm::IsaPred<ArrayType>)) {
10211020
return functionOp.emitOpError() << "cannot emit array type as result type";
10221021
}
10231022

@@ -1619,7 +1618,7 @@ LogicalResult CppEmitter::emitTypes(Location loc, ArrayRef<Type> types) {
16191618
}
16201619

16211620
LogicalResult CppEmitter::emitTupleType(Location loc, ArrayRef<Type> types) {
1622-
if (llvm::any_of(types, [](Type type) { return isa<ArrayType>(type); })) {
1621+
if (llvm::any_of(types, llvm::IsaPred<ArrayType>)) {
16231622
return emitError(loc, "cannot emit tuple of array type");
16241623
}
16251624
os << "std::tuple<";

0 commit comments

Comments
 (0)