This pass transforms scf.while operations to scf.for.
Before:
%0 = scf.while (%i = %c0) : (index) -> index {
%1 = arith.cmpi slt, %i, %arg1 : index
scf.condition(%1) %i : index
} do {
^bb0(%i: index): // no predecessors
%1 = arith.addi %i, %c1 : index
%2 = arith.addi %arg2, %arg2 : i32
memref.store %2, %arg0[%i] : memref<?xi32>
scf.yield %1 : index
}After:
%0 = scf.for %iv = %c0 to %arg1 step %c1 (%i = %c0) {
%1 = arith.addi %iv, %c1 : index
%2 = arith.addi %arg2, %arg2 : i32
memref.store %2, %arg0[%i] : memref<?xi32>
scf.yield %1 : index
}