[Mlir-commits] [mlir] [NFC][scf] Fix error in example for 'IndexSwitchOp' (PR #102628)

Andrey Timonin llvmlistbot at llvm.org
Mon Aug 12 02:21:27 PDT 2024


================
@@ -1121,7 +1121,7 @@ def IndexSwitchOp : SCF_Op<"index_switch", [RecursiveMemoryEffects,
     Example:
 
     ```mlir
-    %0 = scf.index_switch %arg0 : index -> i32
+    %0 = scf.index_switch %arg0 -> i32
----------------
EtoAndruwa wrote:

> Seems like it's not following the usual convention, if we only print the result/operand we should use `:`, like below in: `arith.constant 10 : i32` and `scf.yield %1 : i32`. Can we fix this instead?

To fix that we need to change the parser's logic here: 
```
let assemblyFormat = [{
    $arg attr-dict (`->` type($results)^)?
    custom<SwitchCases>($cases, $caseRegions) `\n`
    `` `default` $defaultRegion
  }];
```
Moreover, many other already written examples use `->` instead of `:`.

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


More information about the Mlir-commits mailing list