Description
The current implementation of WhileOp in the SCF dialect fails when its regions contain more than one block. This is because it accesses the entry block arguments using the .block property of the Region class, which raises a ValueError if the region contains multiple blocks.
In MLIR, scf.while regions are allowed to have multiple blocks (forming a Control Flow Graph). The initialization arguments and results should only be mapped to the entry block of the respective regions.
https://github.com/llvm/llvm-project/blob/47fb7cd732ffc666d2865e1a187db24f8e09ab25/mlir/lib/Dialect/SCF/IR/SCF.cpp#L3328
Expected Behavior
WhileOp should be able to print and verify correctly even if the before or after regions contain multiple blocks.