Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Zekun Wang committed Jun 4, 2024
1 parent be23cd9 commit ef264da
Show file tree
Hide file tree
Showing 53 changed files with 1,022 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,50 @@ fun m::f($t0: u8, $t1: &vector<u64>): u64 {
14: return $t2
}

============ after LiveVarAnalysisProcessor: ================

[variant baseline]
fun m::f($t0: u8, $t1: &vector<u64>): u64 {
var $t2: u64
var $t3: &vector<u64>
var $t4: bool
var $t5: u8
var $t6: &m::R
var $t7: address
var $t8: &u64
var $t9: u64
# live vars: $t0, $t1
0: $t5 := 0
# live vars: $t0, $t1, $t5
1: $t4 := ==($t0, $t5)
# live vars: $t1, $t4
2: if ($t4) goto 3 else goto 8
# live vars: $t1
3: label L0
# live vars:
4: $t7 := 0x1
# live vars: $t7
5: $t6 := borrow_global<m::R>($t7)
# live vars: $t6
6: $t3 := borrow_field<m::R>.data($t6)
# live vars: $t3
7: goto 10
# live vars: $t1
8: label L1
# live vars: $t1
9: $t3 := infer($t1)
# live vars: $t3
10: label L2
# live vars: $t3
11: $t9 := 0
# live vars: $t3, $t9
12: $t8 := vector::borrow<u64>($t3, $t9)
# live vars: $t8
13: $t2 := read_ref($t8)
# live vars: $t2
14: return $t2
}

============ after ReferenceSafetyProcessor: ================

[variant baseline]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,216 @@ fun <SELF>_0::check() {
84: return ()
}

============ after LiveVarAnalysisProcessor: ================

[variant baseline]
fun <SELF>_0::check() {
var $t0: bool
var $t1: u64
var $t2: bool
var $t3: u64
var $t4: bool
var $t5: u64
var $t6: &u64
var $t7: u64
var $t8: u64
var $t9: u64
var $t10: bool
var $t11: vector<u8>
var $t12: &vector<u8>
var $t13: vector<u8>
var $t14: vector<u8>
var $t15: u64
var $t16: &mut u64
var $t17: u64
var $t18: u64
var $t19: &mut vector<u8>
var $t20: vector<u8>
var $t21: vector<u8>
var $t22: bool
var $t23: u64
var $t24: u64
var $t25: u64
var $t26: bool
var $t27: vector<u8>
var $t28: vector<u8>
var $t29: u64
var $t30: bool
var $t31: u64
var $t32: bool
var $t33: u64
# live vars:
0: $t0 := true
# live vars: $t0
1: if ($t0) goto 2 else goto 4
# live vars:
2: label L0
# live vars:
3: goto 7
# live vars:
4: label L1
# live vars:
5: $t1 := 42
# live vars: $t1
6: abort($t1)
# live vars:
7: label L2
# live vars:
8: $t2 := true
# live vars: $t2
9: if ($t2) goto 10 else goto 12
# live vars:
10: label L3
# live vars:
11: goto 15
# live vars:
12: label L4
# live vars:
13: $t3 := 42
# live vars: $t3
14: abort($t3)
# live vars:
15: label L5
# live vars:
16: $t7 := 0
# live vars: $t7
17: $t6 := borrow_local($t7)
# live vars: $t6
18: $t5 := read_ref($t6)
# live vars: $t5
19: $t8 := 0
# live vars: $t5, $t8
20: $t4 := ==($t5, $t8)
# live vars: $t4
21: if ($t4) goto 22 else goto 24
# live vars:
22: label L6
# live vars:
23: goto 27
# live vars:
24: label L7
# live vars:
25: $t9 := 42
# live vars: $t9
26: abort($t9)
# live vars:
27: label L8
# live vars:
28: $t13 := [104, 101, 108, 108, 111]
# live vars: $t13
29: $t12 := borrow_local($t13)
# live vars: $t12
30: $t11 := read_ref($t12)
# live vars: $t11
31: $t14 := [104, 101, 108, 108, 111]
# live vars: $t11, $t14
32: $t10 := ==($t11, $t14)
# live vars: $t10
33: if ($t10) goto 34 else goto 36
# live vars:
34: label L9
# live vars:
35: goto 39
# live vars:
36: label L10
# live vars:
37: $t15 := 42
# live vars: $t15
38: abort($t15)
# live vars:
39: label L11
# live vars:
40: $t17 := 0
# live vars: $t17
41: $t16 := borrow_local($t17)
# live vars: $t16
42: $t18 := 1
# live vars: $t16, $t18
43: write_ref($t16, $t18)
# live vars: $t16
44: $t20 := [104, 101, 108, 108, 111]
# live vars: $t16, $t20
45: $t19 := borrow_local($t20)
# live vars: $t16, $t19
46: $t21 := [98, 121, 101]
# live vars: $t16, $t19, $t21
47: write_ref($t19, $t21)
# live vars: $t16, $t19
48: $t23 := read_ref($t16)
# live vars: $t19, $t23
49: $t24 := 1
# live vars: $t19, $t23, $t24
50: $t22 := ==($t23, $t24)
# live vars: $t19, $t22
51: if ($t22) goto 52 else goto 54
# live vars: $t19
52: label L12
# live vars: $t19
53: goto 57
# live vars: $t19
54: label L13
# live vars:
55: $t25 := 42
# live vars: $t25
56: abort($t25)
# live vars: $t19
57: label L14
# live vars: $t19
58: $t27 := read_ref($t19)
# live vars: $t27
59: $t28 := [98, 121, 101]
# live vars: $t27, $t28
60: $t26 := ==($t27, $t28)
# live vars: $t26
61: if ($t26) goto 62 else goto 64
# live vars:
62: label L15
# live vars:
63: goto 67
# live vars:
64: label L16
# live vars:
65: $t29 := 42
# live vars: $t29
66: abort($t29)
# live vars:
67: label L17
# live vars:
68: $t30 := true
# live vars: $t30
69: if ($t30) goto 70 else goto 72
# live vars:
70: label L18
# live vars:
71: goto 75
# live vars:
72: label L19
# live vars:
73: $t31 := 42
# live vars: $t31
74: abort($t31)
# live vars:
75: label L20
# live vars:
76: $t32 := true
# live vars: $t32
77: if ($t32) goto 78 else goto 80
# live vars:
78: label L21
# live vars:
79: goto 83
# live vars:
80: label L22
# live vars:
81: $t33 := 42
# live vars: $t33
82: abort($t33)
# live vars:
83: label L23
# live vars:
84: return ()
}

============ after ReferenceSafetyProcessor: ================

[variant baseline]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,40 @@ public fun M::f($t0: M::R): (M::R, u64) {
}


[variant baseline]
public fun M::g($t0: &signer) {
var $t1: M::R
var $t2: u64
var $t3: u64
# live vars: $t0
0: $t2 := 1
# live vars: $t0, $t2
1: $t1 := pack M::R($t2)
# live vars: $t0, $t1
2: $t3 := 3
# live vars: $t0, $t1
3: ($t1, $t3) := M::f($t1)
# live vars: $t0, $t1
4: move_to<M::R>($t0, $t1)
# live vars:
5: return ()
}

============ after LiveVarAnalysisProcessor: ================

[variant baseline]
public fun M::f($t0: M::R): (M::R, u64) {
var $t1: M::R
var $t2: u64
# live vars: $t0
0: $t1 := infer($t0)
# live vars: $t1
1: $t2 := 0
# live vars: $t1, $t2
2: return ($t1, $t2)
}


[variant baseline]
public fun M::g($t0: &signer) {
var $t1: M::R
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,23 @@ fun explicate_drop::test0(): u8 {
3: return $t0
}

============ after LiveVarAnalysisProcessor: ================

[variant baseline]
fun explicate_drop::test0(): u8 {
var $t0: u8
var $t1: &u8
var $t2: u8
# live vars:
0: $t2 := 42
# live vars: $t2
1: $t1 := borrow_local($t2)
# live vars: $t1
2: $t0 := read_ref($t1)
# live vars: $t0
3: return $t0
}

============ after ReferenceSafetyProcessor: ================

[variant baseline]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,46 @@ fun m::f($t0: &mut u64): &mut u64 {
}


[variant baseline]
fun m::g() {
var $t0: u64
var $t1: &mut u64
var $t2: &mut u64
var $t3: &u64
# live vars:
0: $t0 := 22
# live vars: $t0
1: $t1 := borrow_local($t0)
# live vars: $t0, $t1
2: $t2 := m::f($t1)
# live vars: $t0, $t2
3: $t1 := infer($t2)
# live vars: $t0
4: $t3 := borrow_local($t0)
# live vars:
5: return ()
}


Diagnostics:
warning: Unused assignment to r. Consider removing or prefixing with an underscore: `_r`
┌─ tests/ability-transform/destroy_after_call.move:8:9
8 │ r = f(r);
│ ^^^^^^^^

============ after LiveVarAnalysisProcessor: ================

[variant baseline]
fun m::f($t0: &mut u64): &mut u64 {
var $t1: &mut u64
# live vars: $t0
0: $t1 := infer($t0)
# live vars: $t1
1: return $t1
}


[variant baseline]
fun m::g() {
var $t0: u64
Expand Down
Loading

0 comments on commit ef264da

Please sign in to comment.