============ initial translation from Move ================ [variant baseline] fun TestBorrow::test1(): TestBorrow::R { var $t0|r: TestBorrow::R var $t1|r_ref: &mut TestBorrow::R var $t2|x_ref: &mut u64 var $t3: u64 var $t4: u64 var $t5: TestBorrow::R var $t6: &mut TestBorrow::R var $t7: &mut TestBorrow::R var $t8: &mut u64 var $t9: u64 var $t10: &mut u64 var $t11: TestBorrow::R 0: $t3 := 3 1: $t4 := 4 2: $t5 := pack TestBorrow::R($t3, $t4) 3: $t0 := $t5 4: $t6 := borrow_local($t0) 5: $t1 := $t6 6: $t7 := move($t1) 7: $t8 := borrow_field.x($t7) 8: $t2 := $t8 9: $t9 := 0 10: $t10 := move($t2) 11: write_ref($t10, $t9) 12: $t11 := move($t0) 13: return $t11 } [variant baseline] fun TestBorrow::test10($t0|b: bool): TestBorrow::R { var $t1|r: TestBorrow::R var $t2|r_field: &mut u64 var $t3|r_ref: &mut TestBorrow::R var $t4: u64 var $t5: u64 var $t6: TestBorrow::R var $t7: &mut TestBorrow::R var $t8: &mut TestBorrow::R var $t9: &mut u64 var $t10: bool var $t11: &mut u64 var $t12: bool var $t13: &mut TestBorrow::R var $t14: &mut u64 var $t15: &mut TestBorrow::R var $t16: u64 var $t17: &mut u64 var $t18: TestBorrow::R 0: $t4 := 3 1: $t5 := 4 2: $t6 := pack TestBorrow::R($t4, $t5) 3: $t1 := $t6 4: $t7 := borrow_local($t1) 5: $t3 := $t7 6: $t8 := copy($t3) 7: $t9 := borrow_field.x($t8) 8: $t2 := $t9 9: $t10 := copy($t0) 10: if ($t10) goto 11 else goto 19 11: label L0 12: $t11 := move($t2) 13: destroy($t11) 14: $t12 := move($t0) 15: $t13 := move($t3) 16: $t14 := TestBorrow::test9($t12, $t13) 17: $t2 := $t14 18: goto 23 19: label L2 20: $t15 := move($t3) 21: destroy($t15) 22: goto 23 23: label L3 24: $t16 := 0 25: $t17 := move($t2) 26: write_ref($t17, $t16) 27: $t18 := move($t1) 28: return $t18 } [variant baseline] fun TestBorrow::test2($t0|x_ref: &mut u64, $t1|v: u64) { var $t2: u64 var $t3: &mut u64 0: $t2 := move($t1) 1: $t3 := move($t0) 2: write_ref($t3, $t2) 3: return () } [variant baseline] public fun TestBorrow::test3($t0|r_ref: &mut TestBorrow::R, $t1|v: u64) { var $t2|x_ref: &mut u64 var $t3: &mut TestBorrow::R var $t4: &mut u64 var $t5: &mut u64 var $t6: u64 0: $t3 := move($t0) 1: $t4 := borrow_field.x($t3) 2: $t2 := $t4 3: $t5 := move($t2) 4: $t6 := move($t1) 5: TestBorrow::test2($t5, $t6) 6: return () } [variant baseline] fun TestBorrow::test4(): TestBorrow::R { var $t0|r: TestBorrow::R var $t1|r_ref: &mut TestBorrow::R var $t2: u64 var $t3: u64 var $t4: TestBorrow::R var $t5: &mut TestBorrow::R var $t6: &mut TestBorrow::R var $t7: u64 var $t8: TestBorrow::R 0: $t2 := 3 1: $t3 := 4 2: $t4 := pack TestBorrow::R($t2, $t3) 3: $t0 := $t4 4: $t5 := borrow_local($t0) 5: $t1 := $t5 6: $t6 := move($t1) 7: $t7 := 0 8: TestBorrow::test3($t6, $t7) 9: $t8 := move($t0) 10: return $t8 } [variant baseline] public fun TestBorrow::test5($t0|r_ref: &mut TestBorrow::R): &mut u64 { var $t1: &mut TestBorrow::R var $t2: &mut u64 0: $t1 := move($t0) 1: $t2 := borrow_field.x($t1) 2: return $t2 } [variant baseline] fun TestBorrow::test6(): TestBorrow::R { var $t0|r: TestBorrow::R var $t1|r_ref: &mut TestBorrow::R var $t2|x_ref: &mut u64 var $t3: u64 var $t4: u64 var $t5: TestBorrow::R var $t6: &mut TestBorrow::R var $t7: &mut TestBorrow::R var $t8: &mut u64 var $t9: &mut u64 var $t10: u64 var $t11: TestBorrow::R 0: $t3 := 3 1: $t4 := 4 2: $t5 := pack TestBorrow::R($t3, $t4) 3: $t0 := $t5 4: $t6 := borrow_local($t0) 5: $t1 := $t6 6: $t7 := move($t1) 7: $t8 := TestBorrow::test5($t7) 8: $t2 := $t8 9: $t9 := move($t2) 10: $t10 := 0 11: TestBorrow::test2($t9, $t10) 12: $t11 := move($t0) 13: return $t11 } [variant baseline] fun TestBorrow::test7($t0|b: bool) { var $t1|r1: TestBorrow::R var $t2|r2: TestBorrow::R var $t3|r_ref: &mut TestBorrow::R var $t4: u64 var $t5: u64 var $t6: TestBorrow::R var $t7: u64 var $t8: u64 var $t9: TestBorrow::R var $t10: &mut TestBorrow::R var $t11: bool var $t12: &mut TestBorrow::R var $t13: &mut TestBorrow::R var $t14: &mut TestBorrow::R var $t15: u64 0: $t4 := 3 1: $t5 := 4 2: $t6 := pack TestBorrow::R($t4, $t5) 3: $t1 := $t6 4: $t7 := 4 5: $t8 := 5 6: $t9 := pack TestBorrow::R($t7, $t8) 7: $t2 := $t9 8: $t10 := borrow_local($t1) 9: $t3 := $t10 10: $t11 := move($t0) 11: if ($t11) goto 12 else goto 18 12: label L0 13: $t12 := move($t3) 14: destroy($t12) 15: $t13 := borrow_local($t2) 16: $t3 := $t13 17: goto 18 18: label L2 19: $t14 := move($t3) 20: $t15 := 0 21: TestBorrow::test3($t14, $t15) 22: return () } [variant baseline] fun TestBorrow::test8($t0|b: bool, $t1|n: u64, $t2|r_ref: &mut TestBorrow::R) { var $t3|r1: TestBorrow::R var $t4|r2: TestBorrow::R var $t5|t_ref: &mut TestBorrow::R var $t6: u64 var $t7: u64 var $t8: TestBorrow::R var $t9: u64 var $t10: u64 var $t11: TestBorrow::R var $t12: &mut TestBorrow::R var $t13: u64 var $t14: u64 var $t15: bool var $t16: &mut TestBorrow::R var $t17: u64 var $t18: u64 var $t19: u64 var $t20: u64 var $t21: bool var $t22: &mut TestBorrow::R var $t23: &mut TestBorrow::R var $t24: u64 var $t25: u64 var $t26: u64 var $t27: bool var $t28: &mut TestBorrow::R var $t29: &mut TestBorrow::R var $t30: u64 var $t31: &mut TestBorrow::R var $t32: &mut TestBorrow::R var $t33: u64 0: $t6 := 3 1: $t7 := 4 2: $t8 := pack TestBorrow::R($t6, $t7) 3: $t3 := $t8 4: $t9 := 4 5: $t10 := 5 6: $t11 := pack TestBorrow::R($t9, $t10) 7: $t4 := $t11 8: $t12 := borrow_local($t4) 9: $t5 := $t12 10: goto 11 11: label L7 12: $t13 := 0 13: $t14 := copy($t1) 14: $t15 := <($t13, $t14) 15: if ($t15) goto 16 else goto 39 16: label L0 17: $t16 := move($t5) 18: destroy($t16) 19: $t17 := copy($t1) 20: $t18 := 2 21: $t19 := /($t17, $t18) 22: $t20 := 0 23: $t21 := ==($t19, $t20) 24: if ($t21) goto 25 else goto 29 25: label L3 26: $t22 := borrow_local($t3) 27: $t5 := $t22 28: goto 33 29: label L5 30: $t23 := borrow_local($t4) 31: $t5 := $t23 32: goto 33 33: label L6 34: $t24 := move($t1) 35: $t25 := 1 36: $t26 := -($t24, $t25) 37: $t1 := $t26 38: goto 11 39: label L2 40: $t27 := move($t0) 41: if ($t27) goto 42 else goto 49 42: label L8 43: $t28 := move($t5) 44: destroy($t28) 45: $t29 := move($t2) 46: $t30 := 0 47: TestBorrow::test3($t29, $t30) 48: goto 56 49: label L10 50: $t31 := move($t2) 51: destroy($t31) 52: $t32 := move($t5) 53: $t33 := 0 54: TestBorrow::test3($t32, $t33) 55: goto 56 56: label L11 57: return () } [variant baseline] fun TestBorrow::test9($t0|b: bool, $t1|r_ref: &mut TestBorrow::R): &mut u64 { var $t2|r_field: &mut u64 var $t3: &mut TestBorrow::R var $t4: &mut u64 var $t5: bool var $t6: &mut u64 var $t7: &mut TestBorrow::R var $t8: &mut u64 var $t9: &mut TestBorrow::R var $t10: u64 var $t11: &mut u64 var $t12: &mut u64 0: $t3 := copy($t1) 1: $t4 := borrow_field.x($t3) 2: $t2 := $t4 3: $t5 := move($t0) 4: if ($t5) goto 5 else goto 12 5: label L0 6: $t6 := move($t2) 7: destroy($t6) 8: $t7 := move($t1) 9: $t8 := borrow_field.y($t7) 10: $t2 := $t8 11: goto 16 12: label L2 13: $t9 := move($t1) 14: destroy($t9) 15: goto 16 16: label L3 17: $t10 := 0 18: $t11 := copy($t2) 19: write_ref($t11, $t10) 20: $t12 := move($t2) 21: return $t12 } ============ after pipeline `borrow_strong` ================ [variant baseline] fun TestBorrow::test1(): TestBorrow::R { var $t0|r: TestBorrow::R var $t1|r_ref: &mut TestBorrow::R var $t2|x_ref: &mut u64 var $t3: u64 var $t4: u64 var $t5: &mut TestBorrow::R var $t6: &mut u64 var $t7: u64 var $t8: TestBorrow::R 0: $t3 := 3 1: $t4 := 4 2: $t0 := pack TestBorrow::R($t3, $t4) 3: $t5 := borrow_local($t0) # live_nodes: Reference($t5) # borrowed_by: LocalRoot($t0) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, LocalRoot($t0))} 4: $t6 := borrow_field.x($t5) # live_nodes: Reference($t6) # borrowed_by: LocalRoot($t0) -> {(@, Reference($t5))}, Reference($t5) -> {(.x (u64), Reference($t6))} # borrows_from: Reference($t5) -> {(@, LocalRoot($t0))}, Reference($t6) -> {(.x (u64), Reference($t5))} 5: $t7 := 0 # live_nodes: Reference($t6) # borrowed_by: LocalRoot($t0) -> {(@, Reference($t5))}, Reference($t5) -> {(.x (u64), Reference($t6))} # borrows_from: Reference($t5) -> {(@, LocalRoot($t0))}, Reference($t6) -> {(.x (u64), Reference($t5))} 6: write_ref($t6, $t7) # borrowed_by: LocalRoot($t0) -> {(@, Reference($t5))}, Reference($t5) -> {(.x (u64), Reference($t6))} # borrows_from: Reference($t5) -> {(@, LocalRoot($t0))}, Reference($t6) -> {(.x (u64), Reference($t5))} 7: $t8 := move($t0) # live_nodes: LocalRoot($t8) # borrowed_by: LocalRoot($t0) -> {(@, Reference($t5))}, Reference($t5) -> {(.x (u64), Reference($t6))} # borrows_from: Reference($t5) -> {(@, LocalRoot($t0))}, Reference($t6) -> {(.x (u64), Reference($t5))} 8: return $t8 } [variant baseline] fun TestBorrow::test10($t0|b: bool): TestBorrow::R { var $t1|r: TestBorrow::R var $t2|r_field: &mut u64 var $t3|r_ref: &mut TestBorrow::R var $t4: u64 var $t5: u64 var $t6: &mut TestBorrow::R var $t7: &mut u64 var $t8: u64 var $t9: TestBorrow::R # live_nodes: LocalRoot($t0) 0: $t4 := 3 # live_nodes: LocalRoot($t0) 1: $t5 := 4 # live_nodes: LocalRoot($t0) 2: $t1 := pack TestBorrow::R($t4, $t5) # live_nodes: LocalRoot($t0) 3: $t6 := borrow_local($t1) # live_nodes: LocalRoot($t0), Reference($t6) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t6))} # borrows_from: Reference($t6) -> {(@, LocalRoot($t1))} 4: $t7 := borrow_field.x($t6) # live_nodes: LocalRoot($t0), Reference($t6), Reference($t7) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t6))}, Reference($t6) -> {(.x (u64), Reference($t7))} # borrows_from: Reference($t6) -> {(@, LocalRoot($t1))}, Reference($t7) -> {(.x (u64), Reference($t6))} 5: $t2 := $t7 # live_nodes: LocalRoot($t0), Reference($t2), Reference($t6), Reference($t7) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t6))}, Reference($t6) -> {(.x (u64), Reference($t7))}, Reference($t7) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(@, Reference($t7))}, Reference($t6) -> {(@, LocalRoot($t1))}, Reference($t7) -> {(.x (u64), Reference($t6))} 6: if ($t0) goto 18 else goto 21 # live_nodes: LocalRoot($t0), Reference($t6), Reference($t7) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t6))}, Reference($t6) -> {(.x (u64), Reference($t7))}, Reference($t7) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(@, Reference($t7))}, Reference($t6) -> {(@, LocalRoot($t1))}, Reference($t7) -> {(.x (u64), Reference($t6))} 7: label L0 # live_nodes: LocalRoot($t0), Reference($t6), Reference($t7) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t6))}, Reference($t6) -> {(.x (u64), Reference($t7))}, Reference($t7) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(@, Reference($t7))}, Reference($t6) -> {(@, LocalRoot($t1))}, Reference($t7) -> {(.x (u64), Reference($t6))} 8: destroy($t7) # live_nodes: LocalRoot($t0), Reference($t6) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t6))}, Reference($t6) -> {(.x (u64), Reference($t7))}, Reference($t7) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(@, Reference($t7))}, Reference($t6) -> {(@, LocalRoot($t1))}, Reference($t7) -> {(.x (u64), Reference($t6))} 9: $t2 := TestBorrow::test9($t0, $t6) # live_nodes: LocalRoot($t0), Reference($t2) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t6))}, Reference($t6) -> {(.y (u64), Reference($t2)), (.x (u64)/@, Reference($t2)), (.x (u64), Reference($t7))}, Reference($t7) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(.y (u64), Reference($t6)), (.x (u64)/@, Reference($t6)), (@, Reference($t7))}, Reference($t6) -> {(@, LocalRoot($t1))}, Reference($t7) -> {(.x (u64), Reference($t6))} 10: goto 13 # live_nodes: LocalRoot($t0), Reference($t2), Reference($t6) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t6))}, Reference($t6) -> {(.x (u64), Reference($t7))}, Reference($t7) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(@, Reference($t7))}, Reference($t6) -> {(@, LocalRoot($t1))}, Reference($t7) -> {(.x (u64), Reference($t6))} 11: label L2 # live_nodes: LocalRoot($t0), Reference($t2), Reference($t6) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t6))}, Reference($t6) -> {(.x (u64), Reference($t7))}, Reference($t7) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(@, Reference($t7))}, Reference($t6) -> {(@, LocalRoot($t1))}, Reference($t7) -> {(.x (u64), Reference($t6))} 12: destroy($t6) # live_nodes: LocalRoot($t0), Reference($t2) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t6))}, Reference($t6) -> {(.y (u64), Reference($t2)), (.x (u64)/@, Reference($t2)), (.x (u64), Reference($t7))}, Reference($t7) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(.y (u64), Reference($t6)), (.x (u64)/@, Reference($t6)), (@, Reference($t7))}, Reference($t6) -> {(@, LocalRoot($t1))}, Reference($t7) -> {(.x (u64), Reference($t6))} 13: label L3 # live_nodes: LocalRoot($t0), Reference($t2) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t6))}, Reference($t6) -> {(.y (u64), Reference($t2)), (.x (u64)/@, Reference($t2)), (.x (u64), Reference($t7))}, Reference($t7) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(.y (u64), Reference($t6)), (.x (u64)/@, Reference($t6)), (@, Reference($t7))}, Reference($t6) -> {(@, LocalRoot($t1))}, Reference($t7) -> {(.x (u64), Reference($t6))} 14: $t8 := 0 # live_nodes: LocalRoot($t0), Reference($t2) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t6))}, Reference($t6) -> {(.y (u64), Reference($t2)), (.x (u64)/@, Reference($t2)), (.x (u64), Reference($t7))}, Reference($t7) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(.y (u64), Reference($t6)), (.x (u64)/@, Reference($t6)), (@, Reference($t7))}, Reference($t6) -> {(@, LocalRoot($t1))}, Reference($t7) -> {(.x (u64), Reference($t6))} 15: write_ref($t2, $t8) # live_nodes: LocalRoot($t0) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t6))}, Reference($t6) -> {(.y (u64), Reference($t2)), (.x (u64)/@, Reference($t2)), (.x (u64), Reference($t7))}, Reference($t7) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(.y (u64), Reference($t6)), (.x (u64)/@, Reference($t6)), (@, Reference($t7))}, Reference($t6) -> {(@, LocalRoot($t1))}, Reference($t7) -> {(.x (u64), Reference($t6))} 16: $t9 := move($t1) # live_nodes: LocalRoot($t0), LocalRoot($t9) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t6))}, Reference($t6) -> {(.y (u64), Reference($t2)), (.x (u64)/@, Reference($t2)), (.x (u64), Reference($t7))}, Reference($t7) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(.y (u64), Reference($t6)), (.x (u64)/@, Reference($t6)), (@, Reference($t7))}, Reference($t6) -> {(@, LocalRoot($t1))}, Reference($t7) -> {(.x (u64), Reference($t6))} 17: return $t9 # live_nodes: LocalRoot($t0), Reference($t2), Reference($t6), Reference($t7) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t6))}, Reference($t6) -> {(.x (u64), Reference($t7))}, Reference($t7) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(@, Reference($t7))}, Reference($t6) -> {(@, LocalRoot($t1))}, Reference($t7) -> {(.x (u64), Reference($t6))} 18: label L4 # live_nodes: LocalRoot($t0), Reference($t2), Reference($t6), Reference($t7) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t6))}, Reference($t6) -> {(.x (u64), Reference($t7))}, Reference($t7) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(@, Reference($t7))}, Reference($t6) -> {(@, LocalRoot($t1))}, Reference($t7) -> {(.x (u64), Reference($t6))} 19: destroy($t2) # live_nodes: LocalRoot($t0), Reference($t6), Reference($t7) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t6))}, Reference($t6) -> {(.x (u64), Reference($t7))}, Reference($t7) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(@, Reference($t7))}, Reference($t6) -> {(@, LocalRoot($t1))}, Reference($t7) -> {(.x (u64), Reference($t6))} 20: goto 7 # live_nodes: LocalRoot($t0), Reference($t2), Reference($t6), Reference($t7) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t6))}, Reference($t6) -> {(.x (u64), Reference($t7))}, Reference($t7) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(@, Reference($t7))}, Reference($t6) -> {(@, LocalRoot($t1))}, Reference($t7) -> {(.x (u64), Reference($t6))} 21: label L5 # live_nodes: LocalRoot($t0), Reference($t2), Reference($t6), Reference($t7) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t6))}, Reference($t6) -> {(.x (u64), Reference($t7))}, Reference($t7) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(@, Reference($t7))}, Reference($t6) -> {(@, LocalRoot($t1))}, Reference($t7) -> {(.x (u64), Reference($t6))} 22: destroy($t7) # live_nodes: LocalRoot($t0), Reference($t2), Reference($t6) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t6))}, Reference($t6) -> {(.x (u64), Reference($t7))}, Reference($t7) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(@, Reference($t7))}, Reference($t6) -> {(@, LocalRoot($t1))}, Reference($t7) -> {(.x (u64), Reference($t6))} 23: goto 11 } [variant baseline] fun TestBorrow::test2($t0|x_ref: &mut u64, $t1|v: u64) { # live_nodes: LocalRoot($t1), Reference($t0) 0: write_ref($t0, $t1) # live_nodes: LocalRoot($t1), Reference($t0) 1: trace_local[x_ref]($t0) # live_nodes: LocalRoot($t1) 2: return () } [variant baseline] public fun TestBorrow::test3($t0|r_ref: &mut TestBorrow::R, $t1|v: u64) { var $t2|x_ref: &mut u64 var $t3: &mut u64 # live_nodes: LocalRoot($t1), Reference($t0) 0: $t3 := borrow_field.x($t0) # live_nodes: LocalRoot($t1), Reference($t0), Reference($t3) # borrowed_by: Reference($t0) -> {(.x (u64), Reference($t3))} # borrows_from: Reference($t3) -> {(.x (u64), Reference($t0))} 1: TestBorrow::test2($t3, $t1) # live_nodes: LocalRoot($t1), Reference($t0) # borrowed_by: Reference($t0) -> {(.x (u64), Reference($t3))} # borrows_from: Reference($t3) -> {(.x (u64), Reference($t0))} 2: trace_local[r_ref]($t0) # live_nodes: LocalRoot($t1) # borrowed_by: Reference($t0) -> {(.x (u64), Reference($t3))} # borrows_from: Reference($t3) -> {(.x (u64), Reference($t0))} 3: return () } [variant baseline] fun TestBorrow::test4(): TestBorrow::R { var $t0|r: TestBorrow::R var $t1|r_ref: &mut TestBorrow::R var $t2: u64 var $t3: u64 var $t4: &mut TestBorrow::R var $t5: u64 var $t6: TestBorrow::R 0: $t2 := 3 1: $t3 := 4 2: $t0 := pack TestBorrow::R($t2, $t3) 3: $t4 := borrow_local($t0) # live_nodes: Reference($t4) # borrowed_by: LocalRoot($t0) -> {(@, Reference($t4))} # borrows_from: Reference($t4) -> {(@, LocalRoot($t0))} 4: $t5 := 0 # live_nodes: Reference($t4) # borrowed_by: LocalRoot($t0) -> {(@, Reference($t4))} # borrows_from: Reference($t4) -> {(@, LocalRoot($t0))} 5: TestBorrow::test3($t4, $t5) # borrowed_by: LocalRoot($t0) -> {(@, Reference($t4))} # borrows_from: Reference($t4) -> {(@, LocalRoot($t0))} 6: $t6 := move($t0) # live_nodes: LocalRoot($t6) # borrowed_by: LocalRoot($t0) -> {(@, Reference($t4))} # borrows_from: Reference($t4) -> {(@, LocalRoot($t0))} 7: return $t6 } [variant baseline] public fun TestBorrow::test5($t0|r_ref: &mut TestBorrow::R): &mut u64 { var $t1: &mut u64 # live_nodes: Reference($t0) 0: $t1 := borrow_field.x($t0) # live_nodes: Reference($t0), Reference($t1) # borrowed_by: Reference($t0) -> {(.x (u64), Reference($t1))} # borrows_from: Reference($t1) -> {(.x (u64), Reference($t0))} 1: trace_local[r_ref]($t0) # live_nodes: Reference($t1) # borrowed_by: Reference($t0) -> {(.x (u64), Reference($t1))} # borrows_from: Reference($t1) -> {(.x (u64), Reference($t0))} 2: return $t1 } [variant baseline] fun TestBorrow::test6(): TestBorrow::R { var $t0|r: TestBorrow::R var $t1|r_ref: &mut TestBorrow::R var $t2|x_ref: &mut u64 var $t3: u64 var $t4: u64 var $t5: &mut TestBorrow::R var $t6: &mut u64 var $t7: u64 var $t8: TestBorrow::R 0: $t3 := 3 1: $t4 := 4 2: $t0 := pack TestBorrow::R($t3, $t4) 3: $t5 := borrow_local($t0) # live_nodes: Reference($t5) # borrowed_by: LocalRoot($t0) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, LocalRoot($t0))} 4: $t6 := TestBorrow::test5($t5) # live_nodes: Reference($t6) # borrowed_by: LocalRoot($t0) -> {(@, Reference($t5))}, Reference($t5) -> {(.x (u64), Reference($t6))} # borrows_from: Reference($t5) -> {(@, LocalRoot($t0))}, Reference($t6) -> {(.x (u64), Reference($t5))} 5: $t7 := 0 # live_nodes: Reference($t6) # borrowed_by: LocalRoot($t0) -> {(@, Reference($t5))}, Reference($t5) -> {(.x (u64), Reference($t6))} # borrows_from: Reference($t5) -> {(@, LocalRoot($t0))}, Reference($t6) -> {(.x (u64), Reference($t5))} 6: TestBorrow::test2($t6, $t7) # borrowed_by: LocalRoot($t0) -> {(@, Reference($t5))}, Reference($t5) -> {(.x (u64), Reference($t6))} # borrows_from: Reference($t5) -> {(@, LocalRoot($t0))}, Reference($t6) -> {(.x (u64), Reference($t5))} 7: $t8 := move($t0) # live_nodes: LocalRoot($t8) # borrowed_by: LocalRoot($t0) -> {(@, Reference($t5))}, Reference($t5) -> {(.x (u64), Reference($t6))} # borrows_from: Reference($t5) -> {(@, LocalRoot($t0))}, Reference($t6) -> {(.x (u64), Reference($t5))} 8: return $t8 } [variant baseline] fun TestBorrow::test7($t0|b: bool) { var $t1|r1: TestBorrow::R var $t2|r2: TestBorrow::R var $t3|r_ref: &mut TestBorrow::R var $t4: u64 var $t5: u64 var $t6: u64 var $t7: u64 var $t8: &mut TestBorrow::R var $t9: &mut TestBorrow::R var $t10: u64 # live_nodes: LocalRoot($t0) 0: $t4 := 3 # live_nodes: LocalRoot($t0) 1: $t5 := 4 # live_nodes: LocalRoot($t0) 2: $t1 := pack TestBorrow::R($t4, $t5) # live_nodes: LocalRoot($t0) 3: $t6 := 4 # live_nodes: LocalRoot($t0) 4: $t7 := 5 # live_nodes: LocalRoot($t0) 5: $t2 := pack TestBorrow::R($t6, $t7) # live_nodes: LocalRoot($t0) 6: $t8 := borrow_local($t1) # live_nodes: LocalRoot($t0), Reference($t8) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t8))} # borrows_from: Reference($t8) -> {(@, LocalRoot($t1))} 7: $t3 := $t8 # live_nodes: LocalRoot($t0), Reference($t3), Reference($t8) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t8))}, Reference($t8) -> {(@, Reference($t3))} # borrows_from: Reference($t3) -> {(@, Reference($t8))}, Reference($t8) -> {(@, LocalRoot($t1))} 8: if ($t0) goto 17 else goto 20 # live_nodes: LocalRoot($t0), Reference($t8) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t8))}, Reference($t8) -> {(@, Reference($t3))} # borrows_from: Reference($t3) -> {(@, Reference($t8))}, Reference($t8) -> {(@, LocalRoot($t1))} 9: label L0 # live_nodes: LocalRoot($t0), Reference($t8) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t8))}, Reference($t8) -> {(@, Reference($t3))} # borrows_from: Reference($t3) -> {(@, Reference($t8))}, Reference($t8) -> {(@, LocalRoot($t1))} 10: destroy($t8) # live_nodes: LocalRoot($t0) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t8))}, Reference($t8) -> {(@, Reference($t3))} # borrows_from: Reference($t3) -> {(@, Reference($t8))}, Reference($t8) -> {(@, LocalRoot($t1))} 11: $t9 := borrow_local($t2) # live_nodes: LocalRoot($t0), Reference($t9) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t8))}, LocalRoot($t2) -> {(@, Reference($t9))}, Reference($t8) -> {(@, Reference($t3))} # borrows_from: Reference($t3) -> {(@, Reference($t8))}, Reference($t8) -> {(@, LocalRoot($t1))}, Reference($t9) -> {(@, LocalRoot($t2))} 12: $t3 := $t9 # live_nodes: LocalRoot($t0), Reference($t3) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t8))}, LocalRoot($t2) -> {(@, Reference($t9))}, Reference($t8) -> {(@, Reference($t3))}, Reference($t9) -> {(@, Reference($t3))} # borrows_from: Reference($t3) -> {(@, Reference($t8)), (@, Reference($t9))}, Reference($t8) -> {(@, LocalRoot($t1))}, Reference($t9) -> {(@, LocalRoot($t2))} 13: label L2 # live_nodes: LocalRoot($t0), Reference($t3) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t8))}, LocalRoot($t2) -> {(@, Reference($t9))}, Reference($t8) -> {(@, Reference($t3))}, Reference($t9) -> {(@, Reference($t3))} # borrows_from: Reference($t3) -> {(@, Reference($t8)), (@, Reference($t9))}, Reference($t8) -> {(@, LocalRoot($t1))}, Reference($t9) -> {(@, LocalRoot($t2))} 14: $t10 := 0 # live_nodes: LocalRoot($t0), Reference($t3) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t8))}, LocalRoot($t2) -> {(@, Reference($t9))}, Reference($t8) -> {(@, Reference($t3))}, Reference($t9) -> {(@, Reference($t3))} # borrows_from: Reference($t3) -> {(@, Reference($t8)), (@, Reference($t9))}, Reference($t8) -> {(@, LocalRoot($t1))}, Reference($t9) -> {(@, LocalRoot($t2))} 15: TestBorrow::test3($t3, $t10) # live_nodes: LocalRoot($t0) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t8))}, LocalRoot($t2) -> {(@, Reference($t9))}, Reference($t8) -> {(@, Reference($t3))}, Reference($t9) -> {(@, Reference($t3))} # borrows_from: Reference($t3) -> {(@, Reference($t8)), (@, Reference($t9))}, Reference($t8) -> {(@, LocalRoot($t1))}, Reference($t9) -> {(@, LocalRoot($t2))} 16: return () # live_nodes: LocalRoot($t0), Reference($t3), Reference($t8) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t8))}, Reference($t8) -> {(@, Reference($t3))} # borrows_from: Reference($t3) -> {(@, Reference($t8))}, Reference($t8) -> {(@, LocalRoot($t1))} 17: label L3 # live_nodes: LocalRoot($t0), Reference($t3), Reference($t8) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t8))}, Reference($t8) -> {(@, Reference($t3))} # borrows_from: Reference($t3) -> {(@, Reference($t8))}, Reference($t8) -> {(@, LocalRoot($t1))} 18: destroy($t3) # live_nodes: LocalRoot($t0), Reference($t8) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t8))}, Reference($t8) -> {(@, Reference($t3))} # borrows_from: Reference($t3) -> {(@, Reference($t8))}, Reference($t8) -> {(@, LocalRoot($t1))} 19: goto 9 # live_nodes: LocalRoot($t0), Reference($t3), Reference($t8) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t8))}, Reference($t8) -> {(@, Reference($t3))} # borrows_from: Reference($t3) -> {(@, Reference($t8))}, Reference($t8) -> {(@, LocalRoot($t1))} 20: label L4 # live_nodes: LocalRoot($t0), Reference($t3), Reference($t8) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t8))}, Reference($t8) -> {(@, Reference($t3))} # borrows_from: Reference($t3) -> {(@, Reference($t8))}, Reference($t8) -> {(@, LocalRoot($t1))} 21: destroy($t8) # live_nodes: LocalRoot($t0), Reference($t3) # borrowed_by: LocalRoot($t1) -> {(@, Reference($t8))}, Reference($t8) -> {(@, Reference($t3))} # borrows_from: Reference($t3) -> {(@, Reference($t8))}, Reference($t8) -> {(@, LocalRoot($t1))} 22: goto 13 } [variant baseline] fun TestBorrow::test8($t0|b: bool, $t1|n: u64, $t2|r_ref: &mut TestBorrow::R) { var $t3|r1: TestBorrow::R var $t4|r2: TestBorrow::R var $t5|t_ref: &mut TestBorrow::R var $t6: u64 var $t7: u64 var $t8: u64 var $t9: u64 var $t10: &mut TestBorrow::R var $t11: u64 var $t12: bool var $t13: u64 var $t14: u64 var $t15: u64 var $t16: bool var $t17: &mut TestBorrow::R var $t18: &mut TestBorrow::R var $t19: u64 var $t20: u64 var $t21: u64 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2) 0: $t6 := 3 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2) 1: $t7 := 4 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2) 2: $t3 := pack TestBorrow::R($t6, $t7) # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2) 3: $t8 := 4 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2) 4: $t9 := 5 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2) 5: $t4 := pack TestBorrow::R($t8, $t9) # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2) 6: $t10 := borrow_local($t4) # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2), Reference($t10) # borrowed_by: LocalRoot($t4) -> {(@, Reference($t10))} # borrows_from: Reference($t10) -> {(@, LocalRoot($t4))} 7: $t5 := $t10 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2), Reference($t5) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 8: label L7 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2), Reference($t5) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 9: $t11 := 0 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2), Reference($t5) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 10: $t12 := <($t11, $t1) # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2), Reference($t5) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 11: if ($t12) goto 12 else goto 30 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2), Reference($t5) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 12: label L0 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2), Reference($t5) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 13: destroy($t5) # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 14: $t13 := 2 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 15: $t14 := /($t1, $t13) # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 16: $t15 := 0 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 17: $t16 := ==($t14, $t15) # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 18: if ($t16) goto 19 else goto 23 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 19: label L3 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 20: $t17 := borrow_local($t3) # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2), Reference($t17) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 21: $t5 := $t17 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2), Reference($t5) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 22: goto 26 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 23: label L5 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 24: $t18 := borrow_local($t4) # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2), Reference($t18) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 25: $t5 := $t18 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2), Reference($t5) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 26: label L6 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2), Reference($t5) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 27: $t19 := 1 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2), Reference($t5) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 28: $t1 := -($t1, $t19) # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2), Reference($t5) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 29: goto 8 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2), Reference($t5) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 30: label L2 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2), Reference($t5) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 31: if ($t0) goto 32 else goto 37 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2), Reference($t5) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 32: label L8 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2), Reference($t5) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 33: destroy($t5) # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 34: $t20 := 0 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 35: TestBorrow::test3($t2, $t20) # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 36: goto 41 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2), Reference($t5) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 37: label L10 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2), Reference($t5) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 38: destroy($t2) # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2), Reference($t5) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 39: $t21 := 0 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2), Reference($t5) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 40: TestBorrow::test3($t5, $t21) # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 41: label L11 # live_nodes: LocalRoot($t0), LocalRoot($t1), Reference($t2) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 42: trace_local[r_ref]($t2) # live_nodes: LocalRoot($t0), LocalRoot($t1) # borrowed_by: LocalRoot($t3) -> {(@, Reference($t17))}, LocalRoot($t4) -> {(@, Reference($t10)), (@, Reference($t18))}, Reference($t10) -> {(@, Reference($t5))}, Reference($t17) -> {(@, Reference($t5))}, Reference($t18) -> {(@, Reference($t5))} # borrows_from: Reference($t5) -> {(@, Reference($t10)), (@, Reference($t17)), (@, Reference($t18))}, Reference($t10) -> {(@, LocalRoot($t4))}, Reference($t17) -> {(@, LocalRoot($t3))}, Reference($t18) -> {(@, LocalRoot($t4))} 43: return () } [variant baseline] fun TestBorrow::test9($t0|b: bool, $t1|r_ref: &mut TestBorrow::R): &mut u64 { var $t2|r_field: &mut u64 var $t3: &mut u64 var $t4: u64 # live_nodes: LocalRoot($t0), Reference($t1) 0: $t3 := borrow_field.x($t1) # live_nodes: LocalRoot($t0), Reference($t1), Reference($t3) # borrowed_by: Reference($t1) -> {(.x (u64), Reference($t3))} # borrows_from: Reference($t3) -> {(.x (u64), Reference($t1))} 1: $t2 := $t3 # live_nodes: LocalRoot($t0), Reference($t1), Reference($t2), Reference($t3) # borrowed_by: Reference($t1) -> {(.x (u64), Reference($t3))}, Reference($t3) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(@, Reference($t3))}, Reference($t3) -> {(.x (u64), Reference($t1))} 2: if ($t0) goto 14 else goto 17 # live_nodes: LocalRoot($t0), Reference($t1), Reference($t3) # borrowed_by: Reference($t1) -> {(.x (u64), Reference($t3))}, Reference($t3) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(@, Reference($t3))}, Reference($t3) -> {(.x (u64), Reference($t1))} 3: label L0 # live_nodes: LocalRoot($t0), Reference($t1), Reference($t3) # borrowed_by: Reference($t1) -> {(.x (u64), Reference($t3))}, Reference($t3) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(@, Reference($t3))}, Reference($t3) -> {(.x (u64), Reference($t1))} 4: destroy($t3) # live_nodes: LocalRoot($t0), Reference($t1) # borrowed_by: Reference($t1) -> {(.x (u64), Reference($t3))}, Reference($t3) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(@, Reference($t3))}, Reference($t3) -> {(.x (u64), Reference($t1))} 5: $t2 := borrow_field.y($t1) # live_nodes: LocalRoot($t0), Reference($t1), Reference($t2) # borrowed_by: Reference($t1) -> {(.y (u64), Reference($t2)), (.x (u64), Reference($t3))}, Reference($t3) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(.y (u64), Reference($t1)), (@, Reference($t3))}, Reference($t3) -> {(.x (u64), Reference($t1))} 6: goto 9 # live_nodes: LocalRoot($t0), Reference($t1), Reference($t2) # borrowed_by: Reference($t1) -> {(.x (u64), Reference($t3))}, Reference($t3) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(@, Reference($t3))}, Reference($t3) -> {(.x (u64), Reference($t1))} 7: label L2 # live_nodes: LocalRoot($t0), Reference($t1), Reference($t2) # borrowed_by: Reference($t1) -> {(.x (u64), Reference($t3))}, Reference($t3) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(@, Reference($t3))}, Reference($t3) -> {(.x (u64), Reference($t1))} 8: destroy($t1) # live_nodes: LocalRoot($t0), Reference($t1), Reference($t2) # borrowed_by: Reference($t1) -> {(.y (u64), Reference($t2)), (.x (u64), Reference($t3))}, Reference($t3) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(.y (u64), Reference($t1)), (@, Reference($t3))}, Reference($t3) -> {(.x (u64), Reference($t1))} 9: label L3 # live_nodes: LocalRoot($t0), Reference($t1), Reference($t2) # borrowed_by: Reference($t1) -> {(.y (u64), Reference($t2)), (.x (u64), Reference($t3))}, Reference($t3) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(.y (u64), Reference($t1)), (@, Reference($t3))}, Reference($t3) -> {(.x (u64), Reference($t1))} 10: $t4 := 0 # live_nodes: LocalRoot($t0), Reference($t1), Reference($t2) # borrowed_by: Reference($t1) -> {(.y (u64), Reference($t2)), (.x (u64), Reference($t3))}, Reference($t3) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(.y (u64), Reference($t1)), (@, Reference($t3))}, Reference($t3) -> {(.x (u64), Reference($t1))} 11: write_ref($t2, $t4) # live_nodes: LocalRoot($t0), Reference($t1), Reference($t2) # borrowed_by: Reference($t1) -> {(.y (u64), Reference($t2)), (.x (u64), Reference($t3))}, Reference($t3) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(.y (u64), Reference($t1)), (@, Reference($t3))}, Reference($t3) -> {(.x (u64), Reference($t1))} 12: trace_local[r_ref]($t1) # live_nodes: LocalRoot($t0), Reference($t2) # borrowed_by: Reference($t1) -> {(.y (u64), Reference($t2)), (.x (u64), Reference($t3))}, Reference($t3) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(.y (u64), Reference($t1)), (@, Reference($t3))}, Reference($t3) -> {(.x (u64), Reference($t1))} 13: return $t2 # live_nodes: LocalRoot($t0), Reference($t1), Reference($t2), Reference($t3) # borrowed_by: Reference($t1) -> {(.x (u64), Reference($t3))}, Reference($t3) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(@, Reference($t3))}, Reference($t3) -> {(.x (u64), Reference($t1))} 14: label L4 # live_nodes: LocalRoot($t0), Reference($t1), Reference($t2), Reference($t3) # borrowed_by: Reference($t1) -> {(.x (u64), Reference($t3))}, Reference($t3) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(@, Reference($t3))}, Reference($t3) -> {(.x (u64), Reference($t1))} 15: destroy($t2) # live_nodes: LocalRoot($t0), Reference($t1), Reference($t3) # borrowed_by: Reference($t1) -> {(.x (u64), Reference($t3))}, Reference($t3) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(@, Reference($t3))}, Reference($t3) -> {(.x (u64), Reference($t1))} 16: goto 3 # live_nodes: LocalRoot($t0), Reference($t1), Reference($t2), Reference($t3) # borrowed_by: Reference($t1) -> {(.x (u64), Reference($t3))}, Reference($t3) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(@, Reference($t3))}, Reference($t3) -> {(.x (u64), Reference($t1))} 17: label L5 # live_nodes: LocalRoot($t0), Reference($t1), Reference($t2), Reference($t3) # borrowed_by: Reference($t1) -> {(.x (u64), Reference($t3))}, Reference($t3) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(@, Reference($t3))}, Reference($t3) -> {(.x (u64), Reference($t1))} 18: destroy($t3) # live_nodes: LocalRoot($t0), Reference($t1), Reference($t2) # borrowed_by: Reference($t1) -> {(.x (u64), Reference($t3))}, Reference($t3) -> {(@, Reference($t2))} # borrows_from: Reference($t2) -> {(@, Reference($t3))}, Reference($t3) -> {(.x (u64), Reference($t1))} 19: goto 7 } ==== borrow analysis summaries ==== fun TestBorrow::test5[baseline] borrowed_by: Reference($t0) -> {(.x (u64), Return(0))} borrows_from: Return(0) -> {(.x (u64), Reference($t0))} fun TestBorrow::test9[baseline] borrowed_by: Reference($t1) -> {(.y (u64), Return(0)), (.x (u64)/@, Return(0))} borrows_from: Return(0) -> {(.y (u64), Reference($t1)), (.x (u64)/@, Reference($t1))}