| Issue |
87430
|
| Summary |
[MLIR] Unable to roundtrip `cf.switch`
|
| Labels |
mlir
|
| Assignees |
|
| Reporter |
Kuree
|
The IR below is an invalid IR since `%0` has two results but can be used directly with `^bb1(%0: i32)`. For some reason `mlir-opt` has no issue with it and even outputs correct IR. The output, however, can't be parsed due to the following error:
```
error: result number not allowed in argument list
0: ^bb1(%0#0 : i32)
^
```
```mlir
module {
func.func @foo(%arg0: i32, %arg1: i1) -> i32 {
%c0_i32 = arith.constant 0 : i32
%0:2 = scf.if %arg1 -> (i32, i32) {
scf.yield %c0_i32, %c0_i32 : i32, i32
} else {
scf.yield %c0_i32, %c0_i32 : i32, i32
}
cf.switch %arg0 : i32, [
default: ^bb2,
0: ^bb1(%0 : i32)
]
^bb1(%1: i32): // pred: ^bb0
return %1 : i32
^bb2: // pred: ^bb0
return %c0_i32 : i32
}
}
```
See godbolt with MLIR trunk: https://godbolt.org/z/szcz8bKEY.
What is the reason behind setting this parameter to false?
https://github.com/llvm/llvm-project/blob/e61d6b74ddf28df196484f6251271f543ae902ab/mlir/lib/Dialect/ControlFlow/IR/ControlFlowOps.cpp#L534-L538
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs