I’m hitting crash in cleanRegionBranchOp when access region.front() or region.back() on mlir with scf.if which has empty else region like
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
}
There’s an assert at
assert(!region.empty() && "expected a non-empty region in an op "
"implementing `RegionBranchOpInterface`");
But scf.if is OK to have empty region as long as it doesn’t has result.
LogicalResult IfOp::verify() {
if (getNumResults() != 0 && getElseRegion().empty())
return emitOpError("must have an else block if defining values");
return success();
}
Is it a bug to assert that ‘RegionBranchOpInterface’ cannot have an empty region?