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

Benjamin Maxwell llvmlistbot at llvm.org
Tue May 14 09:10:42 PDT 2024


================
@@ -872,9 +873,33 @@ struct ConvertArmSMEToLLVMPass
     configureArmSMEToLLVMConversionLegality(target);
     populateArmSMEToLLVMConversionPatterns(converter, patterns);
 
-    if (failed(applyPartialConversion(getOperation(), target,
-                                      std::move(patterns))))
+    Operation *moduleOp = getOperation();
+    if (failed(applyPartialConversion(moduleOp, target, std::move(patterns))))
       signalPassFailure();
+
+    // Walk the function(s) and fail if there are unexpected operations on SME
+    // tile types after conversion.
+    moduleOp->walk([&](func::FuncOp funcOp) {
+      funcOp->walk([&](Operation *op) {
+        // These ops are legal post conversion, skip these.
+        // Note: 'test.some_use' is a dummy op we use extensively in the tests
+        // to prevent tile ops being DCE'd.
+        if (isa<arm_sme::MaterializeSSATileOp, cf::BranchOp, scf::ForOp,
+                scf::YieldOp>(op) ||
+            op->getName().getStringRef() == "test.some_use")
+          return;
----------------
MacDue wrote:

With the recent tile allocation changes I think this should now be:
```suggestion
        if (isa<arm_sme::GetTile, arm_sme::CopyTileOp, cf::BranchOp>(op) ||
            op->getName().getStringRef() == "test.some_use")
          return;
```

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


More information about the Mlir-commits mailing list