[Mlir-commits] [mlir] [mlir][ArmSME] Verify ops on tile types post LLVM conversion (PR #92076)
Benjamin Maxwell
llvmlistbot at llvm.org
Wed May 15 02:15:13 PDT 2024
================
@@ -877,6 +878,26 @@ struct ConvertArmSMEToLLVMPass
if (failed(applyPartialConversion(function, target, std::move(patterns))))
signalPassFailure();
+
+ // Walk the function and fail if there are unexpected operations on SME
+ // tile types after conversion.
+ function->walk([&](Operation *op) {
+ // These ops are legal post conversion, skip these.
+ if (isa<arm_sme::CopyTileOp, arm_sme::GetTileOp, cf::BranchOp>(op) ||
+ !op->isRegistered())
+ return;
+ if (llvm::any_of(op->getResultTypes(),
+ [](Type type) {
+ return arm_sme::isValidSMETileVectorType(type);
+ }) ||
+ llvm::any_of(op->getOperandTypes(), [](Type type) {
+ return arm_sme::isValidSMETileVectorType(type);
+ })) {
----------------
MacDue wrote:
I think you can use `llvm::concat` to avoid doing the any_of twice.
```suggestion
if (llvm::any_of(
llvm::concat(op->getOperandTypes(), op->getResultTypes()),
[](Type type) { return arm_sme::isValidSMETileVectorType(type); })) {
// ...
}
```
https://github.com/llvm/llvm-project/pull/92076
More information about the Mlir-commits
mailing list