Model assignment as value
This PR subtly changes how we represent assignment expressions in order to accurately model them _as expressions_. Specifically, the result of lowering an assignment is now the temporary created for the assignment's lvalue. This allows us to restore the assignment as a value (expression) during codegen. Note how this fixes a bug and cleans up some output.
Joe Savona committed
Mar 21, 2023 at 10:01 UTC
bf1db812a8c1131c21ebe64643e6f4298a8a9295
11 files changed
+169
-167
compiler/forget/src/HIR/BuildHIR.ts
+1
-1
@@ -2009,7 +2009,7 @@ function lowerAssignment(
2009
},
2010
loc,
2011
});
2012
- return { kind: "LoadLocal", place, loc: temporary.loc };
2012
+ return { kind: "LoadLocal", place: temporary, loc: temporary.loc };
2013
}
2014
case "MemberExpression": {
2015
// This can only occur because of a coding error, parsers enforce this condition
compiler/forget/src/ReactiveScopes/CodegenReactiveFunction.ts
+7
-4
@@ -404,10 +404,13 @@ function codegenInstructionNullable(
404
}
405
case InstructionKind.Reassign: {
406
invariant(value !== null, "Expected a value for reassignment");
407
- return createExpressionStatement(
408
- instr.loc,
409
- t.assignmentExpression("=", codegenLValue(lvalue), value)
410
- );
407
+ const expr = t.assignmentExpression("=", codegenLValue(lvalue), value);
408
+ if (instr.lvalue !== null) {
409
+ cx.temp.set(instr.lvalue.identifier.id, expr);
410
+ return null;
411
+ } else {
412
+ return createExpressionStatement(instr.loc, expr);
413
+ }
414
}
415
default: {
416
assertExhaustive(kind, `Unexpected instruction kind '${kind}'`);
compiler/forget/src/__tests__/fixtures/compiler/expression-with-assignment-dynamic.expect.md
+2
-2
@@ -13,8 +13,8 @@ function f(y) {
13
14
```javascript
15
function f(y) {
16
- const x = y;
17
- return x + 2 + 2;
16
+ let x = y;
17
+ return x + (x = 2) + 2;
18
}
19
20
```
compiler/forget/src/__tests__/fixtures/compiler/ssa-reassign-in-rval.expect.md
renamed
+1
-2
@@ -21,8 +21,7 @@ function Component() {
21
let x;
22
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
23
x = foo();
24
- x = bar();
25
- t0 = x(x, 5);
24
+ t0 = x((x = bar()), 5);
25
$[0] = t0;
26
$[1] = x;
27
} else {
compiler/forget/src/__tests__/fixtures/compiler/ssa-reassign-in-rval.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/ternary-assignment-expression.expect.md
+1
-1
@@ -16,7 +16,7 @@ function ternary(props) {
16
function ternary(props) {
17
let x = undefined;
18
19
- const y = props.a ? ((x = 1), 1) : ((x = 2), 2);
19
+ const y = props.a ? (x = 1) : (x = 2);
20
return x + y;
21
}
22
compiler/forget/src/__tests__/fixtures/hir/ssa-renaming-ternary-with-mutation.expect.md
+31
-31
@@ -17,45 +17,45 @@ function foo(props) {
17
18
```javascript
19
bb0 (block):
20
- [1] store $35[1:33] = Array []
21
- [2] store $37[2:33] = StoreLocal Let mutate x$36[2:33] = capture $35[1:33]
22
- [3] mutate $38[3:33] = LoadLocal capture x$36[2:33]
23
- [4] mutate $39 = LoadLocal read props$34
24
- [5] mutate $40 = PropertyLoad read $39.bar
25
- [6] mutate $41 = PropertyCall mutate $38[3:33].push(read $40)
20
+ [1] store $33[1:31] = Array []
21
+ [2] store $35[2:31] = StoreLocal Let mutate x$34[2:31] = capture $33[1:31]
22
+ [3] mutate $36[3:31] = LoadLocal capture x$34[2:31]
23
+ [4] mutate $37 = LoadLocal read props$32
24
+ [5] mutate $38 = PropertyLoad read $37.bar
25
+ [6] mutate $39 = PropertyCall mutate $36[3:31].push(read $38)
26
[7] Ternary test:bb2 fallthrough=bb1
27
bb2 (value):
28
predecessor blocks: bb0
29
- [8] mutate $42 = LoadLocal read props$34
30
- [9] mutate $43 = PropertyLoad read $42.cond
31
- [10] Branch (read $43) then:bb3 else:bb4
29
+ [8] mutate $40 = LoadLocal read props$32
30
+ [9] mutate $41 = PropertyLoad read $40.cond
31
+ [10] Branch (read $41) then:bb3 else:bb4
32
bb3 (value):
33
predecessor blocks: bb2
34
- [14] store $48[14:33] = Array []
35
- [15] store $50[15:33] = StoreLocal Reassign mutate x$36[15:33] = capture $48[14:33]
36
- [17] mutate $52[17:33] = LoadLocal capture x$36[15:33]
37
- [18] mutate $53 = LoadLocal read props$34
38
- [19] mutate $54 = PropertyLoad read $53.foo
39
- [20] mutate $55[20:30] = PropertyCall mutate $52[17:33].push(read $54)
40
- [21] store $57[21:30] = StoreLocal Const mutate $56[7:30] = capture $55[20:30]
41
- [22] Goto bb1
34
+ [13] store $45[13:31] = Array []
35
+ [14] store $47[14:31] = StoreLocal Reassign mutate x$34[14:31] = capture $45[13:31]
36
+ [15] mutate $48[15:31] = LoadLocal capture x$34[14:31]
37
+ [16] mutate $49 = LoadLocal read props$32
38
+ [17] mutate $50 = PropertyLoad read $49.foo
39
+ [18] mutate $51[18:28] = PropertyCall mutate $48[15:31].push(read $50)
40
+ [19] store $53[19:28] = StoreLocal Const mutate $52[7:28] = capture $51[18:28]
41
+ [20] Goto bb1
42
bb4 (value):
43
predecessor blocks: bb2
44
- [23] mutate $58[23:30]:TPrimitive = null
45
- [24] store $60[24:30]:TPrimitive = StoreLocal Const mutate $56[7:30] = read $58[23:30]:TPrimitive
46
- [25] Goto bb1
44
+ [21] mutate $54[21:28]:TPrimitive = null
45
+ [22] store $56[22:28]:TPrimitive = StoreLocal Const mutate $52[7:28] = read $54[21:28]:TPrimitive
46
+ [23] Goto bb1
47
bb1 (block):
48
predecessor blocks: bb3 bb4
49
- $63[7:30]:TPhi: phi(bb3: $56, bb4: $59)
50
- x$36[2:33]:TPhi: phi(bb3: x$36, bb4: x$36)
51
- [26] store $62[26:30] = StoreLocal Const mutate _$61[26:30] = capture $56[7:30]
52
- [27] mutate $64 = Global console
53
- [28] mutate $65[28:30] = LoadLocal capture _$61[26:30]
54
- [29] mutate $66 = PropertyCall read $64.log(mutate $65[28:30])
55
- [30] mutate $67:TFunction = Global mut
56
- [31] mutate $68[31:33] = LoadLocal capture x$36[2:33]
57
- [32] mutate $70 = Call read $67:TFunction(mutate $68[31:33])
58
- [33] mutate $71 = LoadLocal capture x$36[2:33]
59
- [34] Return freeze $71
49
+ $59[7:28]:TPhi: phi(bb3: $52, bb4: $55)
50
+ x$34[2:31]:TPhi: phi(bb3: x$34, bb4: x$34)
51
+ [24] store $58[24:28] = StoreLocal Const mutate _$57[24:28] = capture $52[7:28]
52
+ [25] mutate $60 = Global console
53
+ [26] mutate $61[26:28] = LoadLocal capture _$57[24:28]
54
+ [27] mutate $62 = PropertyCall read $60.log(mutate $61[26:28])
55
+ [28] mutate $63:TFunction = Global mut
56
+ [29] mutate $64[29:31] = LoadLocal capture x$34[2:31]
57
+ [30] mutate $66 = Call read $63:TFunction(mutate $64[29:31])
58
+ [31] mutate $67 = LoadLocal capture x$34[2:31]
59
+ [32] Return freeze $67
60
```
61
\ No newline at end of file
compiler/forget/src/__tests__/fixtures/hir/ssa-renaming-ternary.expect.md
+28
-28
@@ -16,42 +16,42 @@ function foo(props) {
16
17
```javascript
18
bb0 (block):
19
- [1] store $32[1:7] = Array []
20
- [2] store $34[2:7] = StoreLocal Let mutate x$33[2:7] = capture $32[1:7]
21
- [3] mutate $35[3:7] = LoadLocal capture x$33[2:7]
22
- [4] mutate $36 = LoadLocal read props$31
23
- [5] mutate $37 = PropertyLoad read $36.bar
24
- [6] mutate $38 = PropertyCall mutate $35[3:7].push(read $37)
19
+ [1] store $30[1:7] = Array []
20
+ [2] store $32[2:7] = StoreLocal Let mutate x$31[2:7] = capture $30[1:7]
21
+ [3] mutate $33[3:7] = LoadLocal capture x$31[2:7]
22
+ [4] mutate $34 = LoadLocal read props$29
23
+ [5] mutate $35 = PropertyLoad read $34.bar
24
+ [6] mutate $36 = PropertyCall mutate $33[3:7].push(read $35)
25
[7] Ternary test:bb2 fallthrough=bb1
26
bb2 (value):
27
predecessor blocks: bb0
28
- [8] mutate $39 = LoadLocal read props$31
29
- [9] mutate $40 = PropertyLoad read $39.cond
30
- [10] Branch (read $40) then:bb3 else:bb4
28
+ [8] mutate $37 = LoadLocal read props$29
29
+ [9] mutate $38 = PropertyLoad read $37.cond
30
+ [10] Branch (read $38) then:bb3 else:bb4
31
bb3 (value):
32
predecessor blocks: bb2
33
- [14] store $45[14:21] = Array []
34
- [15] store $47[15:21] = StoreLocal Reassign mutate x$33[15:21] = capture $45[14:21]
35
- [17] mutate $49[17:21] = LoadLocal capture x$33[15:21]
36
- [18] mutate $50 = LoadLocal read props$31
37
- [19] mutate $51 = PropertyLoad read $50.foo
38
- [20] mutate $52[20:30] = PropertyCall mutate $49[17:21].push(read $51)
39
- [21] store $54[21:30] = StoreLocal Const mutate $53[7:30] = capture $52[20:30]
40
- [22] Goto bb1
33
+ [13] store $42[13:19] = Array []
34
+ [14] store $44[14:19] = StoreLocal Reassign mutate x$31[14:19] = capture $42[13:19]
35
+ [15] mutate $45[15:19] = LoadLocal capture x$31[14:19]
36
+ [16] mutate $46 = LoadLocal read props$29
37
+ [17] mutate $47 = PropertyLoad read $46.foo
38
+ [18] mutate $48[18:28] = PropertyCall mutate $45[15:19].push(read $47)
39
+ [19] store $50[19:28] = StoreLocal Const mutate $49[7:28] = capture $48[18:28]
40
+ [20] Goto bb1
41
bb4 (value):
42
predecessor blocks: bb2
43
- [23] mutate $55[23:30]:TPrimitive = null
44
- [24] store $57[24:30]:TPrimitive = StoreLocal Const mutate $53[7:30] = read $55[23:30]:TPrimitive
45
- [25] Goto bb1
43
+ [21] mutate $51[21:28]:TPrimitive = null
44
+ [22] store $53[22:28]:TPrimitive = StoreLocal Const mutate $49[7:28] = read $51[21:28]:TPrimitive
45
+ [23] Goto bb1
46
bb1 (block):
47
predecessor blocks: bb3 bb4
48
- $60[7:30]:TPhi: phi(bb3: $53, bb4: $56)
49
- x$33:TPhi: phi(bb3: x$33, bb4: x$33)
50
- [26] store $59[26:30] = StoreLocal Const mutate _$58[26:30] = capture $53[7:30]
51
- [27] mutate $61 = Global console
52
- [28] mutate $62[28:30] = LoadLocal capture _$58[26:30]
53
- [29] mutate $63 = PropertyCall read $61.log(mutate $62[28:30])
54
- [30] mutate $64 = LoadLocal capture x$33
55
- [31] Return freeze $64
48
+ $56[7:28]:TPhi: phi(bb3: $49, bb4: $52)
49
+ x$31:TPhi: phi(bb3: x$31, bb4: x$31)
50
+ [24] store $55[24:28] = StoreLocal Const mutate _$54[24:28] = capture $49[7:28]
51
+ [25] mutate $57 = Global console
52
+ [26] mutate $58[26:28] = LoadLocal capture _$54[24:28]
53
+ [27] mutate $59 = PropertyCall read $57.log(mutate $58[26:28])
54
+ [28] mutate $60 = LoadLocal capture x$31
55
+ [29] Return freeze $60
56
```
57
\ No newline at end of file
compiler/forget/src/__tests__/fixtures/hir/ssa-renaming-unconditional-ternary-with-mutation.expect.md
+36
-36
@@ -19,50 +19,50 @@ function foo(props) {
19
20
```javascript
21
bb0 (block):
22
- [1] store $44[1:7] = Array []
23
- [2] store $46[2:7] = StoreLocal Let mutate x$45[2:42] = capture $44[1:7]
24
- [3] mutate $47[3:7] = LoadLocal capture x$45[2:42]
25
- [4] mutate $48 = LoadLocal read props$43
26
- [5] mutate $49 = PropertyLoad read $48.bar
27
- [6] mutate $50 = PropertyCall mutate $47[3:7].push(read $49)
22
+ [1] store $40[1:7] = Array []
23
+ [2] store $42[2:7] = StoreLocal Let mutate x$41[2:38] = capture $40[1:7]
24
+ [3] mutate $43[3:7] = LoadLocal capture x$41[2:38]
25
+ [4] mutate $44 = LoadLocal read props$39
26
+ [5] mutate $45 = PropertyLoad read $44.bar
27
+ [6] mutate $46 = PropertyCall mutate $43[3:7].push(read $45)
28
[7] Ternary test:bb2 fallthrough=bb1
29
bb2 (value):
30
predecessor blocks: bb0
31
- [8] mutate $51 = LoadLocal read props$43
32
- [9] mutate $52 = PropertyLoad read $51.cond
33
- [10] Branch (read $52) then:bb3 else:bb4
31
+ [8] mutate $47 = LoadLocal read props$39
32
+ [9] mutate $48 = PropertyLoad read $47.cond
33
+ [10] Branch (read $48) then:bb3 else:bb4
34
bb3 (value):
35
predecessor blocks: bb2
36
- [14] store $57[14:42] = Array []
37
- [15] store $59[15:42] = StoreLocal Reassign mutate x$45[15:42] = capture $57[14:42]
38
- [17] mutate $61[17:42] = LoadLocal capture x$45[15:42]
39
- [18] mutate $62 = LoadLocal read props$43
40
- [19] mutate $63 = PropertyLoad read $62.foo
41
- [20] mutate $64[20:39] = PropertyCall mutate $61[17:42].push(read $63)
42
- [21] store $66[21:39] = StoreLocal Const mutate $65[7:39] = capture $64[20:39]
43
- [22] Goto bb1
36
+ [13] store $52[13:38] = Array []
37
+ [14] store $54[14:38] = StoreLocal Reassign mutate x$41[14:38] = capture $52[13:38]
38
+ [15] mutate $55[15:38] = LoadLocal capture x$41[14:38]
39
+ [16] mutate $56 = LoadLocal read props$39
40
+ [17] mutate $57 = PropertyLoad read $56.foo
41
+ [18] mutate $58[18:35] = PropertyCall mutate $55[15:38].push(read $57)
42
+ [19] store $60[19:35] = StoreLocal Const mutate $59[7:35] = capture $58[18:35]
43
+ [20] Goto bb1
44
bb4 (value):
45
predecessor blocks: bb2
46
- [26] store $71[26:42] = Array []
47
- [27] store $73[27:42] = StoreLocal Reassign mutate x$45[27:42] = capture $71[26:42]
48
- [29] mutate $75[29:42] = LoadLocal capture x$45[27:42]
49
- [30] mutate $76 = LoadLocal read props$43
50
- [31] mutate $77 = PropertyLoad read $76.bar
51
- [32] mutate $78[32:39] = PropertyCall mutate $75[29:42].push(read $77)
52
- [33] store $80[33:39] = StoreLocal Const mutate $65[7:39] = capture $78[32:39]
53
- [34] Goto bb1
46
+ [23] store $64[23:38] = Array []
47
+ [24] store $66[24:38] = StoreLocal Reassign mutate x$41[24:38] = capture $64[23:38]
48
+ [25] mutate $67[25:38] = LoadLocal capture x$41[24:38]
49
+ [26] mutate $68 = LoadLocal read props$39
50
+ [27] mutate $69 = PropertyLoad read $68.bar
51
+ [28] mutate $70[28:35] = PropertyCall mutate $67[25:38].push(read $69)
52
+ [29] store $72[29:35] = StoreLocal Const mutate $59[7:35] = capture $70[28:35]
53
+ [30] Goto bb1
54
bb1 (block):
55
predecessor blocks: bb3 bb4
56
- $83[7:39]:TPhi: phi(bb3: $65, bb4: $79)
57
- x$45[15:42]:TPhi: phi(bb3: x$45, bb4: x$45)
58
- [35] store $82[35:39] = StoreLocal Const mutate _$81[35:39] = capture $65[7:39]
59
- [36] mutate $84 = Global console
60
- [37] mutate $85[37:39] = LoadLocal capture _$81[35:39]
61
- [38] mutate $86 = PropertyCall read $84.log(mutate $85[37:39])
62
- [39] mutate $87:TFunction = Global mut
63
- [40] mutate $88[40:42] = LoadLocal capture x$45[15:42]
64
- [41] mutate $90 = Call read $87:TFunction(mutate $88[40:42])
65
- [42] mutate $91 = LoadLocal capture x$45[15:42]
66
- [43] Return freeze $91
56
+ $75[7:35]:TPhi: phi(bb3: $59, bb4: $71)
57
+ x$41[14:38]:TPhi: phi(bb3: x$41, bb4: x$41)
58
+ [31] store $74[31:35] = StoreLocal Const mutate _$73[31:35] = capture $59[7:35]
59
+ [32] mutate $76 = Global console
60
+ [33] mutate $77[33:35] = LoadLocal capture _$73[31:35]
61
+ [34] mutate $78 = PropertyCall read $76.log(mutate $77[33:35])
62
+ [35] mutate $79:TFunction = Global mut
63
+ [36] mutate $80[36:38] = LoadLocal capture x$41[14:38]
64
+ [37] mutate $82 = Call read $79:TFunction(mutate $80[36:38])
65
+ [38] mutate $83 = LoadLocal capture x$41[14:38]
66
+ [39] Return freeze $83
67
```
68
\ No newline at end of file
compiler/forget/src/__tests__/fixtures/hir/ssa-renaming-unconditional-ternary.expect.md
+33
-33
@@ -18,47 +18,47 @@ function foo(props) {
18
19
```javascript
20
bb0 (block):
21
- [1] store $41[1:7] = Array []
22
- [2] store $43[2:7] = StoreLocal Let mutate x$42[2:7] = capture $41[1:7]
23
- [3] mutate $44[3:7] = LoadLocal capture x$42[2:7]
24
- [4] mutate $45 = LoadLocal read props$40
25
- [5] mutate $46 = PropertyLoad read $45.bar
26
- [6] mutate $47 = PropertyCall mutate $44[3:7].push(read $46)
21
+ [1] store $37[1:7] = Array []
22
+ [2] store $39[2:7] = StoreLocal Let mutate x$38[2:7] = capture $37[1:7]
23
+ [3] mutate $40[3:7] = LoadLocal capture x$38[2:7]
24
+ [4] mutate $41 = LoadLocal read props$36
25
+ [5] mutate $42 = PropertyLoad read $41.bar
26
+ [6] mutate $43 = PropertyCall mutate $40[3:7].push(read $42)
27
[7] Ternary test:bb2 fallthrough=bb1
28
bb2 (value):
29
predecessor blocks: bb0
30
- [8] mutate $48 = LoadLocal read props$40
31
- [9] mutate $49 = PropertyLoad read $48.cond
32
- [10] Branch (read $49) then:bb3 else:bb4
30
+ [8] mutate $44 = LoadLocal read props$36
31
+ [9] mutate $45 = PropertyLoad read $44.cond
32
+ [10] Branch (read $45) then:bb3 else:bb4
33
bb3 (value):
34
predecessor blocks: bb2
35
- [14] store $54[14:21] = Array []
36
- [15] store $56[15:21] = StoreLocal Reassign mutate x$42[15:21] = capture $54[14:21]
37
- [17] mutate $58[17:21] = LoadLocal capture x$42[15:21]
38
- [18] mutate $59 = LoadLocal read props$40
39
- [19] mutate $60 = PropertyLoad read $59.foo
40
- [20] mutate $61[20:39] = PropertyCall mutate $58[17:21].push(read $60)
41
- [21] store $63[21:39] = StoreLocal Const mutate $62[7:39] = capture $61[20:39]
42
- [22] Goto bb1
35
+ [13] store $49[13:19] = Array []
36
+ [14] store $51[14:19] = StoreLocal Reassign mutate x$38[14:19] = capture $49[13:19]
37
+ [15] mutate $52[15:19] = LoadLocal capture x$38[14:19]
38
+ [16] mutate $53 = LoadLocal read props$36
39
+ [17] mutate $54 = PropertyLoad read $53.foo
40
+ [18] mutate $55[18:35] = PropertyCall mutate $52[15:19].push(read $54)
41
+ [19] store $57[19:35] = StoreLocal Const mutate $56[7:35] = capture $55[18:35]
42
+ [20] Goto bb1
43
bb4 (value):
44
predecessor blocks: bb2
45
- [26] store $68[26:33] = Array []
46
- [27] store $70[27:33] = StoreLocal Reassign mutate x$42[27:33] = capture $68[26:33]
47
- [29] mutate $72[29:33] = LoadLocal capture x$42[27:33]
48
- [30] mutate $73 = LoadLocal read props$40
49
- [31] mutate $74 = PropertyLoad read $73.bar
50
- [32] mutate $75[32:39] = PropertyCall mutate $72[29:33].push(read $74)
51
- [33] store $77[33:39] = StoreLocal Const mutate $62[7:39] = capture $75[32:39]
52
- [34] Goto bb1
45
+ [23] store $61[23:29] = Array []
46
+ [24] store $63[24:29] = StoreLocal Reassign mutate x$38[24:29] = capture $61[23:29]
47
+ [25] mutate $64[25:29] = LoadLocal capture x$38[24:29]
48
+ [26] mutate $65 = LoadLocal read props$36
49
+ [27] mutate $66 = PropertyLoad read $65.bar
50
+ [28] mutate $67[28:35] = PropertyCall mutate $64[25:29].push(read $66)
51
+ [29] store $69[29:35] = StoreLocal Const mutate $56[7:35] = capture $67[28:35]
52
+ [30] Goto bb1
53
bb1 (block):
54
predecessor blocks: bb3 bb4
55
- $80[7:39]:TPhi: phi(bb3: $62, bb4: $76)
56
- x$42:TPhi: phi(bb3: x$42, bb4: x$42)
57
- [35] store $79[35:39] = StoreLocal Const mutate _$78[35:39] = capture $62[7:39]
58
- [36] mutate $81 = Global console
59
- [37] mutate $82[37:39] = LoadLocal capture _$78[35:39]
60
- [38] mutate $83 = PropertyCall read $81.log(mutate $82[37:39])
61
- [39] mutate $84 = LoadLocal capture x$42
62
- [40] Return freeze $84
55
+ $72[7:35]:TPhi: phi(bb3: $56, bb4: $68)
56
+ x$38:TPhi: phi(bb3: x$38, bb4: x$38)
57
+ [31] store $71[31:35] = StoreLocal Const mutate _$70[31:35] = capture $56[7:35]
58
+ [32] mutate $73 = Global console
59
+ [33] mutate $74[33:35] = LoadLocal capture _$70[31:35]
60
+ [34] mutate $75 = PropertyCall read $73.log(mutate $74[33:35])
61
+ [35] mutate $76 = LoadLocal capture x$38
62
+ [36] Return freeze $76
63
```
64
\ No newline at end of file
compiler/forget/src/__tests__/fixtures/hir/ssa-renaming-unconditional-with-mutation.expect.md
+29
-29
@@ -24,40 +24,40 @@ function foo(props) {
24
25
```javascript
26
bb0 (block):
27
- [1] store $36[1:7] = Array []
28
- [2] store $38[2:7] = StoreLocal Let mutate x$37[2:35] = capture $36[1:7]
29
- [3] mutate $39[3:7] = LoadLocal capture x$37[2:35]
30
- [4] mutate $40 = LoadLocal read props$35
31
- [5] mutate $41 = PropertyLoad read $40.bar
32
- [6] mutate $42 = PropertyCall mutate $39[3:7].push(read $41)
33
- [7] mutate $43 = LoadLocal read props$35
34
- [8] mutate $44 = PropertyLoad read $43.cond
35
- [9] If (read $44) then:bb2 else:bb3 fallthrough=bb1
27
+ [1] store $32[1:7] = Array []
28
+ [2] store $34[2:7] = StoreLocal Let mutate x$33[2:31] = capture $32[1:7]
29
+ [3] mutate $35[3:7] = LoadLocal capture x$33[2:31]
30
+ [4] mutate $36 = LoadLocal read props$31
31
+ [5] mutate $37 = PropertyLoad read $36.bar
32
+ [6] mutate $38 = PropertyCall mutate $35[3:7].push(read $37)
33
+ [7] mutate $39 = LoadLocal read props$31
34
+ [8] mutate $40 = PropertyLoad read $39.cond
35
+ [9] If (read $40) then:bb2 else:bb3 fallthrough=bb1
36
bb2 (block):
37
predecessor blocks: bb0
38
- [13] store $49[13:35] = Array []
39
- [14] store $51[14:35] = StoreLocal Reassign mutate x$37[14:35] = capture $49[13:35]
40
- [16] mutate $53[16:35] = LoadLocal capture x$37[14:35]
41
- [17] mutate $54 = LoadLocal read props$35
42
- [18] mutate $55 = PropertyLoad read $54.foo
43
- [19] mutate $56 = PropertyCall mutate $53[16:35].push(read $55)
44
- [20] Goto bb1
38
+ [12] store $44[12:31] = Array []
39
+ [13] store $46[13:31] = StoreLocal Reassign mutate x$33[13:31] = capture $44[12:31]
40
+ [14] mutate $47[14:31] = LoadLocal capture x$33[13:31]
41
+ [15] mutate $48 = LoadLocal read props$31
42
+ [16] mutate $49 = PropertyLoad read $48.foo
43
+ [17] mutate $50 = PropertyCall mutate $47[14:31].push(read $49)
44
+ [18] Goto bb1
45
bb3 (block):
46
predecessor blocks: bb0
47
- [24] store $61[24:35] = Array []
48
- [25] store $63[25:35] = StoreLocal Reassign mutate x$37[25:35] = capture $61[24:35]
49
- [27] mutate $65[27:35] = LoadLocal capture x$37[25:35]
50
- [28] mutate $66 = LoadLocal read props$35
51
- [29] mutate $67 = PropertyLoad read $66.bar
52
- [30] mutate $68 = PropertyCall mutate $65[27:35].push(read $67)
53
- [31] Goto bb1
47
+ [21] store $54[21:31] = Array []
48
+ [22] store $56[22:31] = StoreLocal Reassign mutate x$33[22:31] = capture $54[21:31]
49
+ [23] mutate $57[23:31] = LoadLocal capture x$33[22:31]
50
+ [24] mutate $58 = LoadLocal read props$31
51
+ [25] mutate $59 = PropertyLoad read $58.bar
52
+ [26] mutate $60 = PropertyCall mutate $57[23:31].push(read $59)
53
+ [27] Goto bb1
54
bb1 (block):
55
predecessor blocks: bb2 bb3
56
- x$37[14:35]:TPhi: phi(bb2: x$37, bb3: x$37)
57
- [32] mutate $69:TFunction = Global mut
58
- [33] mutate $70[33:35] = LoadLocal capture x$37[14:35]
59
- [34] mutate $72 = Call read $69:TFunction(mutate $70[33:35])
60
- [35] mutate $73 = LoadLocal capture x$37[14:35]
61
- [36] Return freeze $73
56
+ x$33[13:31]:TPhi: phi(bb2: x$33, bb3: x$33)
57
+ [28] mutate $61:TFunction = Global mut
58
+ [29] mutate $62[29:31] = LoadLocal capture x$33[13:31]
59
+ [30] mutate $64 = Call read $61:TFunction(mutate $62[29:31])
60
+ [31] mutate $65 = LoadLocal capture x$33[13:31]
61
+ [32] Return freeze $65
62
```
63
\ No newline at end of file