Issue |
123246
|
Summary |
[mlir] -remove-dead-values crashes on scf.if for empty region
|
Labels |
mlir,
crash
|
Assignees |
|
Reporter |
python3kgae
|
reproduce with: mlir-opt -remove-dead-values a.mlir
a.mlir:
```
func.func @nested_if(%cond0: i1, %cond1: i1, %cond2: i1, %p: memref<1xf32>) {
%cst = arith.constant 1.000000e+00 : f32
scf.if %cond0 {
} else {
scf.if %cond1 {
} else {
scf.if %cond2 {
affine.store %cst, %p[0] : memref<1xf32>
}
}
}
return
}
```
It will crash in cleanRegionBranchOp when access region.front() or region.back().
And could be worked around by adding
```
if (region.empty())
continue;
```
to all these access.
There's assert in one of the access:
```
assert(!region.empty() && "expected a non-empty region in an op "
"implementing `RegionBranchOpInterface`");
```
But scf.if seems OK to return an empty region for getElseRegion.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs