// instrs 4 script { // One instruction. fn less_one_block() -> u64 { entry(): v0 = const u64 11 ret u64 v0 } // Two instructions. fn less_two_blocks() -> u64 { entry(): v0 = const u64 22 br block(v0) block(v1: u64): ret u64 v1 } // Three instructions. fn less_three_blocks(b: bool) -> u64 { entry(b: bool): cbr b, then_block(), else_block() then_block(): v0 = const u64 33 ret u64 v0 else_block(): v1 = const u64 44 ret u64 v1 } // Four cmp instructions and a ret. fn more_one_block() -> bool { entry(): v0 = const u64 55 v1 = const u64 66 v2 = cmp eq v0 v1 v3 = const bool true v4 = cmp eq v2 v3 v5 = const bool true v6 = cmp eq v4 v5 v7 = const bool true v8 = cmp eq v6 v7 ret bool v8 } // Four cmp instructions, a br and a ret. fn more_two_blocks() -> bool { entry(): v0 = const u64 77 v1 = const u64 88 v2 = cmp eq v0 v1 v3 = const bool true v4 = cmp eq v2 v3 v5 = const bool true v6 = cmp eq v4 v5 v7 = const bool true v8 = cmp eq v6 v7 br block(v8) block(v9: bool): ret bool v9 } // Four cmp instructions, a cbr an two rets. fn more_three_blocks(b: bool) -> bool { entry(b: bool): cbr b, then_block(), else_block() then_block(): v0 = const u64 99 v1 = const u64 1010 v2 = cmp eq v0 v1 v3 = const bool true v4 = cmp eq v2 v3 ret bool v4 else_block(): v5 = const u64 1111 v6 = const u64 1212 v7 = cmp eq v5 v6 v8 = const bool true v9 = cmp eq v7 v8 ret bool v9 } fn main() -> bool { // check: fn main() -> bool entry(): v0 = call less_one_block() // not: call less_one_block // check: const u64 11 v1 = call less_two_blocks() // not: call less_two_blocks // check: const u64 22 v2 = const bool true v3 = call less_three_blocks(v2) // not: call less_three_blocks // check: const u64 33 // check: const u64 44 v4 = call more_one_block() // check: call more_one_block // not: const u64 55 // not: const u64 66 v5 = call more_two_blocks() // check: call more_two_blocks // not: const u64 77 // not: const u64 88 v6 = call more_three_blocks(v5) // check: call more_three_blocks // not: const u64 99 // not: const u64 1010 // not: const u64 1111 // not: const u64 1212 ret bool v6 } }