Back to PBT run

input.mlir

#loop_ann = #llvm.loop_annotation<mustProgress = true>

llvm.func @plain_diamond_0(%c: i1, %a: i32, %b: i32) -> i32 {
  cf.cond_br %c, ^yes, ^no
^yes:
  cf.br ^exit(%a : i32)
^no:
  cf.br ^exit(%b : i32)
^exit(%r: i32):
  llvm.return %r : i32
}

llvm.func @weighted_then_plain_1(%weighted: i1, %plain: i1, %a: i32, %b: i32) -> i32 {
  cf.cond_br %weighted weights([7, 3]), ^weighted_true, ^weighted_false
^weighted_true:
  cf.br ^plain_entry(%a : i32)
^weighted_false:
  cf.br ^plain_entry(%b : i32)
^plain_entry(%seed: i32):
  cf.cond_br %plain, ^plain_true, ^plain_false
^plain_true:
  cf.br ^exit(%seed : i32)
^plain_false:
  cf.br ^exit(%seed : i32)
^exit(%r: i32):
  llvm.return %r : i32
}

llvm.func @counted_cycle_2(%limit: i32) -> i32 {
  %zero = arith.constant 0 : i32
  %step = arith.constant 4 : i32
  cf.br ^header(%zero : i32)
^header(%iv: i32):
  %done = arith.cmpi eq, %iv, %limit : i32
  cf.cond_br %done, ^exit, ^latch
^latch:
  %next = arith.addi %iv, %step : i32
  cf.br ^header(%next : i32)
^exit:
  llvm.return %iv : i32
}

llvm.func @weighted_then_cycle_3(%weighted: i1, %limit: i32) -> i32 {
  %zero = arith.constant 0 : i32
  %one = arith.constant 1 : i32
  cf.cond_br %weighted weights([3, 7]), ^left, ^right
^left:
  cf.br ^header(%zero : i32)
^right:
  cf.br ^header(%one : i32)
^header(%iv: i32):
  %done = arith.cmpi eq, %iv, %limit : i32
  cf.cond_br %done, ^exit, ^latch
^latch:
  %next = arith.addi %iv, %one : i32
  cf.br ^header(%next : i32)
^exit:
  llvm.return %iv : i32
}