[Mlir-commits] [mlir] [mlir][ArmSME] Verify ops on tile types post LLVM conversion (PR #92076)

Benjamin Maxwell llvmlistbot at llvm.org
Wed May 15 06:32:59 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:

Ah, I don't think there's any way around that right now. Maybe just factor the lambda out (to make the `if` a little easier to read): 
```
auto isSMETIleType = [](Type type) {  return arm_sme::isValidSMETileVectorType(type); })
```


https://github.com/llvm/llvm-project/pull/92076


More information about the Mlir-commits mailing list