[Mlir-commits] [mlir] [mlir][ArmSME] Replace nested-region assertion in tile allocation with diagnostic (PR #181934)

Benjamin Maxwell llvmlistbot at llvm.org
Wed Feb 18 00:57:53 PST 2026


================
@@ -343,24 +343,31 @@ struct LiveRange {
 /// Operations are numbered consecutively wihin blocks, and the blocks are
 /// topologically sorted (using forward edges). This function is only correct if
 /// all ArmSME have been converted to CF (which is asserted).
-DenseMap<Operation *, unsigned>
+FailureOr<DenseMap<Operation *, unsigned>>
 generateOperationNumbering(FunctionOpInterface function) {
   unsigned index = 0;
   SetVector<Block *> blocks =
       getBlocksSortedByDominance(function.getFunctionBody());
   DenseMap<Operation *, unsigned> operationToIndexMap;
+  bool sawNestedArmSMEOp = false;
   for (Block *block : blocks) {
     index++; // We want block args to have their own number.
     for (Operation &op : block->getOperations()) {
-#ifndef NDEBUG
       op.walk([&](ArmSMETileOpInterface nestedOp) {
-        assert(&op == nestedOp.getOperation() &&
-               "ArmSME tile allocation does not support nested regions");
+        if (&op == nestedOp.getOperation())
+          return;
+        nestedOp.emitError(
+            "ArmSME tile allocation requires flattened control flow; run "
+            "-convert-scf-to-cf before this pass (e.g. via "
+            "convert-arm-sme-to-llvm pipeline)");
+        sawNestedArmSMEOp = true;
----------------
MacDue wrote:

Below this you'd then do:
```
WalkResult result = op.walk(...)
if (result.wasInterrupted())
  return failure(); 
```

See: https://github.com/llvm/llvm-project/blob/7897d928be14089870469342d497a822befaf39d/mlir/lib/Dialect/WasmSSA/IR/WasmSSAInterfaces.cpp#L32-L43C31 for reference. 

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


More information about the Mlir-commits mailing list