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 @sequential_diamonds_1(%first: i1, %second: i1, %a: i32, %b: i32) -> i32 {
  %k = arith.constant 1 : i32
  cf.cond_br %first, ^one_yes, ^one_no
^one_yes:
  cf.br ^middle(%a : i32)
^one_no:
  cf.br ^middle(%b : i32)
^middle(%seed: i32):
  cf.cond_br %second, ^two_yes, ^two_no
^two_yes:
  %sum = arith.addi %seed, %k : i32
  cf.br ^exit(%sum : i32)
^two_no:
  cf.br ^exit(%seed : i32)
^exit(%r: i32):
  llvm.return %r : i32
}

llvm.func @sequential_diamonds_2(%first: i1, %second: i1, %a: i32, %b: i32) -> i32 {
  %k = arith.constant 3 : i32
  cf.cond_br %first, ^one_yes, ^one_no
^one_yes:
  cf.br ^middle(%a : i32)
^one_no:
  cf.br ^middle(%b : i32)
^middle(%seed: i32):
  cf.cond_br %second, ^two_yes, ^two_no
^two_yes:
  %sum = arith.addi %seed, %k : i32
  cf.br ^exit(%sum : i32)
^two_no:
  cf.br ^exit(%seed : i32)
^exit(%r: i32):
  llvm.return %r : i32
}