Back to PBT run

input.mlir

module {
dataflow.graph private @while_case0(%start: none, %limit: i32, %input: memref<?xi32>, %output: memref<?xi32>) -> ()
    attributes {input_segments = array<i32: 1, 0, 2>,
                result_segments = array<i32: 0, 0, 0>} {
  %zero = arith.constant 0 : i32
  %one = arith.constant 1 : i32
  %bound = arith.constant 6 : i32
  %res:2 = scf.while (%s0 = %zero, %s1 = %zero) : (i32, i32) -> (i32, i32) {
    %idx0 = arith.index_cast %s0 : i32 to index
    %v0 = memref.load %input[%idx0] : memref<?xi32>
    %n0 = arith.addi %s0, %one : i32
    %n1 = arith.addi %s1, %v0 : i32
    %c = arith.cmpi slt, %n0, %bound : i32
    scf.condition(%c) %n0, %n1 : i32, i32
  } do {
  ^bb0(%b0: i32, %b1: i32):
    scf.yield %b0, %b1 : i32, i32
  }
  %oidx0 = arith.index_cast %zero : i32 to index
  memref.store %res#0, %output[%oidx0] : memref<?xi32>
  %oidx1 = arith.index_cast %one : i32 to index
  memref.store %res#1, %output[%oidx1] : memref<?xi32>
  dataflow.graph.return %start : none
}
dataflow.graph private @while_case1(%start: none, %limit: i32, %input: memref<?xi32>, %output: memref<?xi32>) -> ()
    attributes {input_segments = array<i32: 1, 0, 2>,
                result_segments = array<i32: 0, 0, 0>} {
  %zero = arith.constant 0 : i32
  %one = arith.constant 1 : i32
  %bound = arith.constant 5 : i32
  %res:3 = scf.while (%s0 = %zero, %s1 = %zero, %s2 = %one) : (i32, i32, i32) -> (i32, i32, i32) {
    %idx0 = arith.index_cast %s0 : i32 to index
    %v0 = memref.load %input[%idx0] : memref<?xi32>
    %n0 = arith.addi %s0, %one : i32
    %n1 = arith.addi %s1, %v0 : i32
    %n2 = arith.addi %s2, %n0 : i32
    memref.store %n1, %output[%idx0] : memref<?xi32>
    %c = arith.cmpi slt, %n0, %limit : i32
    scf.condition(%c) %n0, %n1, %n2 : i32, i32, i32
  } do {
  ^bb0(%b0: i32, %b1: i32, %b2: i32):
    %d1 = arith.addi %b1, %b0 : i32
    scf.yield %b0, %d1, %b2 : i32, i32, i32
  }
  %oidx0 = arith.index_cast %zero : i32 to index
  memref.store %res#0, %output[%oidx0] : memref<?xi32>
  %oidx1 = arith.index_cast %one : i32 to index
  memref.store %res#1, %output[%oidx1] : memref<?xi32>
  %otwo = arith.constant 2 : i32
  %oidx2 = arith.index_cast %otwo : i32 to index
  memref.store %res#2, %output[%oidx2] : memref<?xi32>
  dataflow.graph.return %start : none
}
}