@samitouri / QOS-React-2 / commits / 855d13f4b2

Add instruction ids to terminals

[ghstack-poisoned] closes #799

Joseph Savona committed Nov 21, 2022 at 11:51 UTC 855d13f4b23b0af8b7004fd29ac7425e3636ba8a
62 files changed +784 -722
compiler/forget/src/HIR/BuildHIR.ts
+44 -3
@@ -119,7 +119,11 @@ function lowerStatement(
119 case "ThrowStatement": {
120 const stmt = stmtPath as NodePath<t.ThrowStatement>;
121 const value = lowerExpressionToPlace(builder, stmt.get("argument"));
122 - const terminal: ThrowTerminal = { kind: "throw", value };
122 + const terminal: ThrowTerminal = {
123 + kind: "throw",
124 + value,
125 + id: makeInstructionId(0),
126 + };
127 builder.terminate(terminal);
128 return;
129 }
@@ -133,6 +137,7 @@ function lowerStatement(
137 const terminal: ReturnTerminal = {
138 kind: "return",
139 value,
140 + id: makeInstructionId(0),
141 };
142 builder.terminateWithContinuation(terminal, fallthrough);
143 return;
@@ -148,6 +153,7 @@ function lowerStatement(
153 kind: "goto",
154 block: continuationBlock.id,
155 variant: GotoVariant.Break,
156 + id: makeInstructionId(0),
157 };
158 });
159 // Block for the alternate (if the test is not truthy)
@@ -160,6 +166,7 @@ function lowerStatement(
166 kind: "goto",
167 block: continuationBlock.id,
168 variant: GotoVariant.Break,
169 + id: makeInstructionId(0),
170 };
171 });
172 } else {
@@ -173,6 +180,7 @@ function lowerStatement(
180 consequent: consequentBlock,
181 alternate: alternateBlock,
182 fallthrough: continuationBlock.id,
183 + id: makeInstructionId(0),
184 };
185 builder.terminateWithContinuation(terminal, continuationBlock);
186 return;
@@ -189,6 +197,7 @@ function lowerStatement(
197 kind: "goto",
198 block,
199 variant: GotoVariant.Break,
200 + id: makeInstructionId(0),
201 });
202 return;
203 }
@@ -199,6 +208,7 @@ function lowerStatement(
208 kind: "goto",
209 block,
210 variant: GotoVariant.Continue,
211 + id: makeInstructionId(0),
212 });
213 return;
214 }
@@ -219,6 +229,7 @@ function lowerStatement(
229 kind: "goto",
230 block: conditionalBlock.id,
231 variant: GotoVariant.Continue,
232 + id: makeInstructionId(0),
233 };
234 }
235 );
@@ -229,6 +240,7 @@ function lowerStatement(
240 kind: "goto",
241 block: conditionalBlock.id,
242 variant: GotoVariant.Break,
243 + id: makeInstructionId(0),
244 },
245 conditionalBlock
246 );
@@ -244,6 +256,7 @@ function lowerStatement(
256 consequent: loopBlock,
257 alternate: continuationBlock.id,
258 fallthrough: continuationBlock.id,
259 + id: makeInstructionId(0),
260 };
261 builder.terminateWithContinuation(terminal, continuationBlock);
262 return;
@@ -269,6 +282,7 @@ function lowerStatement(
282 kind: "goto",
283 block: conditionalBlock.id,
284 variant: GotoVariant.Continue,
285 + id: makeInstructionId(0),
286 };
287 }
288 );
@@ -279,6 +293,7 @@ function lowerStatement(
293 kind: "goto",
294 block: conditionalBlock.id,
295 variant: GotoVariant.Break,
296 + id: makeInstructionId(0),
297 },
298 conditionalBlock
299 );
@@ -294,6 +309,7 @@ function lowerStatement(
309 consequent: loopBlock,
310 alternate: continuationBlock.id,
311 fallthrough: continuationBlock.id,
312 + id: makeInstructionId(0),
313 };
314 builder.terminateWithContinuation(terminal, continuationBlock);
315 return;
@@ -328,6 +344,7 @@ function lowerStatement(
344 kind: "goto",
345 block: conditionalBlock.id,
346 variant: GotoVariant.Break,
347 + id: makeInstructionId(0),
348 });
349 /**
350 * Construct the loop itself: the loop body wraps around to the update block
@@ -340,6 +357,7 @@ function lowerStatement(
357 kind: "goto",
358 block: updateBlock.id,
359 variant: GotoVariant.Continue,
360 + id: makeInstructionId(0),
361 };
362 });
363 });
@@ -349,6 +367,7 @@ function lowerStatement(
367 kind: "goto",
368 block: conditionalBlock.id,
369 variant: GotoVariant.Break,
370 + id: makeInstructionId(0),
371 },
372 conditionalBlock
373 );
@@ -366,6 +385,7 @@ function lowerStatement(
385 consequent: loopBlock,
386 alternate: continuationBlock.id,
387 fallthrough: continuationBlock.id,
388 + id: makeInstructionId(0),
389 };
390 } else {
391 /**
@@ -376,6 +396,7 @@ function lowerStatement(
396 kind: "goto",
397 block: loopBlock,
398 variant: GotoVariant.Break,
399 + id: makeInstructionId(0),
400 };
401 }
402 builder.terminateWithContinuation(terminal, continuationBlock);
@@ -400,13 +421,19 @@ function lowerStatement(
421 consequent: loopBlock,
422 alternate: continuationBlock.id,
423 fallthrough: continuationBlock.id,
424 + id: makeInstructionId(0),
425 };
426 return terminal;
427 });
428 });
429 // do-while unconditionally enters the loop
430 builder.terminateWithContinuation(
409 - { kind: "goto", block: loopBlock, variant: GotoVariant.Break },
431 + {
432 + kind: "goto",
433 + block: loopBlock,
434 + variant: GotoVariant.Break,
435 + id: makeInstructionId(0),
436 + },
437 continuationBlock
438 );
439 return;
@@ -429,6 +456,7 @@ function lowerStatement(
456 kind: "goto",
457 block: conditionalBlock.id,
458 variant: GotoVariant.Continue,
459 + id: makeInstructionId(0),
460 };
461 }
462 );
@@ -443,6 +471,7 @@ function lowerStatement(
471 test: conditionalBlock.id,
472 loop: loopBlock,
473 fallthrough: continuationBlock.id,
474 + id: makeInstructionId(0),
475 },
476 conditionalBlock
477 );
@@ -457,6 +486,7 @@ function lowerStatement(
486 consequent: loopBlock,
487 alternate: continuationBlock.id,
488 fallthrough: continuationBlock.id,
489 + id: makeInstructionId(0),
490 };
491 // Complete the conditional and continue with code after the loop
492 builder.terminateWithContinuation(terminal, continuationBlock);
@@ -489,6 +519,7 @@ function lowerStatement(
519 kind: "goto",
520 block: continuationBlock.id,
521 variant: GotoVariant.Break,
522 + id: makeInstructionId(0),
523 },
524 continuationBlock
525 );
@@ -535,6 +566,7 @@ function lowerStatement(
566 kind: "goto",
567 block: fallthrough,
568 variant: GotoVariant.Break,
569 + id: makeInstructionId(0),
570 };
571 });
572 });
@@ -559,7 +591,13 @@ function lowerStatement(
591
592 const test = lowerExpressionToPlace(builder, stmt.get("discriminant"));
593 builder.terminateWithContinuation(
562 - { kind: "switch", test, cases, fallthrough: continuationBlock.id },
594 + {
595 + kind: "switch",
596 + test,
597 + cases,
598 + fallthrough: continuationBlock.id,
599 + id: makeInstructionId(0),
600 + },
601 continuationBlock
602 );
603 return;
@@ -1069,6 +1107,7 @@ function lowerConditional(
1107 kind: "goto",
1108 block: continuationBlock.id,
1109 variant: GotoVariant.Break,
1110 + id: makeInstructionId(0),
1111 };
1112 });
1113 // Block for the alternate (if the test is not truthy)
@@ -1084,6 +1123,7 @@ function lowerConditional(
1123 kind: "goto",
1124 block: continuationBlock.id,
1125 variant: GotoVariant.Break,
1126 + id: makeInstructionId(0),
1127 };
1128 });
1129 const terminal: IfTerminal = {
@@ -1092,6 +1132,7 @@ function lowerConditional(
1132 consequent: consequentBlock,
1133 alternate: alternateBlock,
1134 fallthrough: continuationBlock.id,
1135 + id: makeInstructionId(0),
1136 };
1137 builder.terminateWithContinuation(terminal, continuationBlock);
1138 return place;
compiler/forget/src/HIR/HIR.ts
+10 -2
@@ -121,14 +121,19 @@ export type Terminal =
121 | SwitchTerminal
122 | WhileTerminal;
123
124 -export type ThrowTerminal = { kind: "throw"; value: Place };
124 +export type ThrowTerminal = { kind: "throw"; value: Place; id: InstructionId };
125
126 -export type ReturnTerminal = { kind: "return"; value: Place | null };
126 +export type ReturnTerminal = {
127 + kind: "return";
128 + value: Place | null;
129 + id: InstructionId;
130 +};
131
132 export type GotoTerminal = {
133 kind: "goto";
134 block: BlockId;
135 variant: GotoVariant;
136 + id: InstructionId;
137 };
138
139 export enum GotoVariant {
@@ -142,6 +147,7 @@ export type IfTerminal = {
147 consequent: BlockId;
148 alternate: BlockId;
149 fallthrough: BlockId | null;
150 + id: InstructionId;
151 };
152
153 export type SwitchTerminal = {
@@ -149,6 +155,7 @@ export type SwitchTerminal = {
155 test: Place;
156 cases: Array<{ test: Place | null; block: BlockId }>;
157 fallthrough: BlockId | null;
158 + id: InstructionId;
159 };
160
161 export type WhileTerminal = {
@@ -156,6 +163,7 @@ export type WhileTerminal = {
163 test: BlockId;
164 loop: BlockId;
165 fallthrough: BlockId;
166 + id: InstructionId;
167 };
168
169 /**
compiler/forget/src/HIR/HIRBuilder.ts
+2 -1
@@ -145,7 +145,7 @@ export default class HIRBuilder {
145 this.#completed.set(blockId, {
146 id: blockId,
147 instructions,
148 - terminal: { kind: "return", value: null },
148 + terminal: { kind: "return", value: null, id: makeInstructionId(0) },
149 preds: new Set(),
150 phis: new Set(),
151 });
@@ -508,6 +508,7 @@ function markInstructionIds(func: HIR) {
508 invariant(instr.id === 0, `${printInstruction(instr)} already visited!`);
509 instr.id = makeInstructionId(++id);
510 }
511 + block.terminal.id = makeInstructionId(++id);
512 }
513 }
514
compiler/forget/src/HIR/PrintHIR.ts
+6 -6
@@ -115,30 +115,30 @@ function printTerminal(terminal: Terminal): Array<string> | string {
115 let value;
116 switch (terminal.kind) {
117 case "if": {
118 - value = `If (${printPlace(terminal.test)}) then:bb${
118 + value = `[${terminal.id}] If (${printPlace(terminal.test)}) then:bb${
119 terminal.consequent
120 } else:bb${terminal.alternate}`;
121 break;
122 }
123 case "throw": {
124 - value = `Throw ${printPlace(terminal.value)}`;
124 + value = `[${terminal.id}] Throw ${printPlace(terminal.value)}`;
125 break;
126 }
127 case "return": {
128 - value = `Return${
128 + value = `[${terminal.id}] Return${
129 terminal.value != null ? " " + printPlace(terminal.value) : ""
130 }`;
131 break;
132 }
133 case "goto": {
134 - value = `Goto${
134 + value = `[${terminal.id}] Goto${
135 terminal.variant === GotoVariant.Continue ? "(Continue)" : ""
136 } bb${terminal.block}`;
137 break;
138 }
139 case "switch": {
140 const output = [];
141 - output.push(`Switch (${printPlace(terminal.test)})`);
141 + output.push(`[${terminal.id}] Switch (${printPlace(terminal.test)})`);
142 terminal.cases.forEach((case_) => {
143 if (case_.test !== null) {
144 output.push(` Case ${printPlace(case_.test)}: bb${case_.block}`);
@@ -150,7 +150,7 @@ function printTerminal(terminal: Terminal): Array<string> | string {
150 break;
151 }
152 case "while": {
153 - value = `While test=bb${terminal.test} loop=${
153 + value = `[${terminal.id}] While test=bb${terminal.test} loop=${
154 terminal.loop !== null ? `bb${terminal.loop}` : ""
155 } fallthrough=${terminal.fallthrough ? `bb${terminal.fallthrough}` : ""}`;
156 break;
compiler/forget/src/HIR/visitors.ts
+13 -1
@@ -6,7 +6,14 @@
6 */
7
8 import { assertExhaustive } from "../Common/utils";
9 -import { BasicBlock, BlockId, Instruction, Place, Terminal } from "./HIR";
9 +import {
10 + BasicBlock,
11 + BlockId,
12 + Instruction,
13 + makeInstructionId,
14 + Place,
15 + Terminal,
16 +} from "./HIR";
17
18 export function* eachInstructionOperand(instr: Instruction): Iterable<Place> {
19 const instrValue = instr.value;
@@ -143,6 +150,7 @@ export function mapTerminalSuccessors(
150 kind: "goto",
151 block: target,
152 variant: terminal.variant,
153 + id: makeInstructionId(0),
154 };
155 }
156 case "if": {
@@ -156,6 +164,7 @@ export function mapTerminalSuccessors(
164 consequent,
165 alternate,
166 fallthrough,
167 + id: makeInstructionId(0),
168 };
169 }
170 case "switch": {
@@ -173,12 +182,14 @@ export function mapTerminalSuccessors(
182 test: terminal.test,
183 cases,
184 fallthrough,
185 + id: makeInstructionId(0),
186 };
187 }
188 case "return": {
189 return {
190 kind: "return",
191 value: terminal.value,
192 + id: makeInstructionId(0),
193 };
194 }
195 case "throw": {
@@ -193,6 +204,7 @@ export function mapTerminalSuccessors(
204 test,
205 loop,
206 fallthrough,
207 + id: makeInstructionId(0),
208 };
209 }
210 default: {
compiler/forget/src/__tests__/fixtures/hir/alias-while.expect.md
+27 -27
@@ -27,27 +27,27 @@ function mutate(x, y) {}
27
28 ```
29 bb0:
30 - [1] Let mutate a$2_@0[0:9] = Object { }
31 - [2] Let mutate b$3_@0[0:9] = Object { }
32 - [3] Let mutate c$4_@0[0:9] = Object { }
33 - While test=bb1 loop=bb3 fallthrough=bb2
30 + [1] Let mutate a$2_@0[0:11] = Object { }
31 + [2] Let mutate b$3_@0[0:11] = Object { }
32 + [3] Let mutate c$4_@0[0:11] = Object { }
33 + [4] While test=bb1 loop=bb3 fallthrough=bb2
34 bb1:
35 predecessor blocks: bb0 bb3
36 - If (read cond$1) then:bb3 else:bb2
36 + [5] If (read cond$1) then:bb3 else:bb2
37 bb3:
38 predecessor blocks: bb1
39 - [4] Let mutate z$5_@0[0:9] = read a$2_@0
40 - [5] Reassign mutate a$2_@0[0:9] = read b$3_@0
41 - [6] Reassign mutate b$3_@0[0:9] = read c$4_@0
42 - [7] Reassign mutate c$4_@0[0:9] = read z$5_@0
43 - [8] Call mutate mutate$6_@0(mutate a$2_@0, mutate b$3_@0)
44 - Goto(Continue) bb1
39 + [6] Let mutate z$5_@0[0:11] = read a$2_@0
40 + [7] Reassign mutate a$2_@0[0:11] = read b$3_@0
41 + [8] Reassign mutate b$3_@0[0:11] = read c$4_@0
42 + [9] Reassign mutate c$4_@0[0:11] = read z$5_@0
43 + [10] Call mutate mutate$6_@0(mutate a$2_@0, mutate b$3_@0)
44 + [11] Goto(Continue) bb1
45 bb2:
46 predecessor blocks: bb1
47 - [9] read a$2_@0
48 - [10] read b$3_@0
49 - [11] read c$4_@0
50 - Return freeze a$2_@0
47 + [12] read a$2_@0
48 + [13] read b$3_@0
49 + [14] read c$4_@0
50 + [15] Return freeze a$2_@0
51 ```
52
53 ### CFG
@@ -57,9 +57,9 @@ flowchart TB
57 %% Basic Blocks
58 subgraph bb0
59 bb0_instrs["
60 - [1] Let mutate a$2_@0[0:9] = Object { }
61 - [2] Let mutate b$3_@0[0:9] = Object { }
62 - [3] Let mutate c$4_@0[0:9] = Object { }
60 + [1] Let mutate a$2_@0[0:11] = Object { }
61 + [2] Let mutate b$3_@0[0:11] = Object { }
62 + [3] Let mutate c$4_@0[0:11] = Object { }
63 "]
64 bb0_instrs --> bb0_terminal(["While"])
65 end
@@ -68,19 +68,19 @@ flowchart TB
68 end
69 subgraph bb3
70 bb3_instrs["
71 - [4] Let mutate z$5_@0[0:9] = read a$2_@0
72 - [5] Reassign mutate a$2_@0[0:9] = read b$3_@0
73 - [6] Reassign mutate b$3_@0[0:9] = read c$4_@0
74 - [7] Reassign mutate c$4_@0[0:9] = read z$5_@0
75 - [8] Call mutate mutate$6_@0(mutate a$2_@0, mutate b$3_@0)
71 + [6] Let mutate z$5_@0[0:11] = read a$2_@0
72 + [7] Reassign mutate a$2_@0[0:11] = read b$3_@0
73 + [8] Reassign mutate b$3_@0[0:11] = read c$4_@0
74 + [9] Reassign mutate c$4_@0[0:11] = read z$5_@0
75 + [10] Call mutate mutate$6_@0(mutate a$2_@0, mutate b$3_@0)
76 "]
77 bb3_instrs --> bb3_terminal(["Goto"])
78 end
79 subgraph bb2
80 bb2_instrs["
81 - [9] read a$2_@0
82 - [10] read b$3_@0
83 - [11] read c$4_@0
81 + [12] read a$2_@0
82 + [13] read b$3_@0
83 + [14] read c$4_@0
84 "]
85 bb2_instrs --> bb2_terminal(["Return freeze a$2_@0"])
86 end
@@ -121,7 +121,7 @@ function foo$0(cond$1) {
121
122 ```
123 bb0:
124 - Return
124 + [1] Return
125 ```
126
127 ### CFG
compiler/forget/src/__tests__/fixtures/hir/assignment-variations.expect.md
+2 -2
@@ -27,7 +27,7 @@ bb0:
27 [5] Reassign mutate x$1_@4 = Binary read x$1_@2 + read $3_@3
28 [6] Const mutate $4_@5 = 1
29 [7] Reassign mutate x$1_@6 = Binary read x$1_@4 >>> read $4_@5
30 - Return
30 + [8] Return
31 ```
32
33 ### CFG
@@ -72,7 +72,7 @@ bb0:
72 [2] Reassign mutate a$1_@1.b.c[0:5] = Binary read a$1_@1.b.c + read $2_@0
73 [3] Const mutate $3_@2 = 2
74 [4] Reassign mutate a$1_@1.b.c[0:5] = Binary read a$1_@1.b.c * read $3_@2
75 - Return
75 + [5] Return
76 ```
77
78 ### CFG
compiler/forget/src/__tests__/fixtures/hir/call.expect.md
+2 -2
@@ -19,7 +19,7 @@ function Component(props) {
19
20 ```
21 bb0:
22 - Return
22 + [1] Return
23 ```
24
25 ### CFG
@@ -55,7 +55,7 @@ bb0:
55 [6] Call mutate foo$4_@0(mutate b$3_@0)
56 [7] Const mutate $7_@3 = "div"
57 [8] Const mutate $8_@4 = JSX <read $7_@3 a={read a$2_@0} b={freeze b$3_@0} ></read $7_@3>
58 - Return read $8_@4
58 + [9] Return read $8_@4
59 ```
60
61 ### CFG
compiler/forget/src/__tests__/fixtures/hir/complex-while.expect.md
+6 -6
@@ -18,22 +18,22 @@ function foo(a, b, c) {
18
19 ```
20 bb0:
21 - If (read a$1) then:bb3 else:bb1
21 + [1] If (read a$1) then:bb3 else:bb1
22 bb3:
23 predecessor blocks: bb0
24 - While test=bb4 loop=bb6 fallthrough=bb1
24 + [2] While test=bb4 loop=bb6 fallthrough=bb1
25 bb4:
26 predecessor blocks: bb3 bb7
27 - If (read b$2) then:bb6 else:bb1
27 + [3] If (read b$2) then:bb6 else:bb1
28 bb6:
29 predecessor blocks: bb4
30 - If (read c$3) then:bb1 else:bb7
30 + [4] If (read c$3) then:bb1 else:bb7
31 bb7:
32 predecessor blocks: bb6
33 - Goto(Continue) bb4
33 + [5] Goto(Continue) bb4
34 bb1:
35 predecessor blocks: bb6 bb4 bb0
36 - Return
36 + [6] Return
37 ```
38
39 ### CFG
compiler/forget/src/__tests__/fixtures/hir/component.expect.md
+50 -50
@@ -37,56 +37,56 @@ function Component(props) {
37 bb0:
38 [1] Const mutate items$2_@0 = read props$1.items
39 [2] Const mutate maxItems$3_@1 = read props$1.maxItems
40 - [3] Const mutate renderedItems$4_@2[3:15] = Array []
41 - [4] Const mutate seen$5_@3[0:12] = New mutate Set$6_@3()
40 + [3] Const mutate renderedItems$4_@2[3:22] = Array []
41 + [4] Const mutate seen$5_@3[0:19] = New mutate Set$6_@3()
42 [5] Const mutate $9_@4 = 0
43 [6] Const mutate max$7_@5[0:7] = Call mutate Math$8_@5.max(read $9_@4, read maxItems$3_@1)
44 - Goto bb1
44 + [7] Goto bb1
45 bb1:
46 predecessor blocks: bb0 bb5 bb10
47 - If (read items$2_@0) then:bb3 else:bb2
47 + [8] If (read items$2_@0) then:bb3 else:bb2
48 bb3:
49 predecessor blocks: bb1
50 - [7] Const mutate $11_@6 = null
51 - [8] Const mutate $12_@3[0:12] = Binary read item$10_@3 == read $11_@6
52 - If (read $12_@3) then:bb8 else:bb9
50 + [9] Const mutate $11_@6 = null
51 + [10] Const mutate $12_@3[0:19] = Binary read item$10_@3 == read $11_@6
52 + [11] If (read $12_@3) then:bb8 else:bb9
53 bb8:
54 predecessor blocks: bb3
55 - [9] Const mutate $13_@3[0:12] = read $12_@3
56 - Goto bb7
55 + [12] Const mutate $13_@3[0:19] = read $12_@3
56 + [13] Goto bb7
57 bb9:
58 predecessor blocks: bb3
59 - [10] Const mutate $13_@3[0:12] = Call mutate seen$5_@3.has(mutate item$10_@3)
60 - Goto bb7
59 + [14] Const mutate $13_@3[0:19] = Call mutate seen$5_@3.has(mutate item$10_@3)
60 + [15] Goto bb7
61 bb7:
62 predecessor blocks: bb8 bb9
63 - If (read $13_@3) then:bb5 else:bb4
63 + [16] If (read $13_@3) then:bb5 else:bb4
64 bb5:
65 predecessor blocks: bb7
66 - Goto(Continue) bb1
66 + [17] Goto(Continue) bb1
67 bb4:
68 predecessor blocks: bb7
69 - [11] Call mutate seen$5_@3.add(mutate item$10_@3)
70 - [12] Const mutate $14_@7 = "div"
71 - [13] Const mutate $15_@8 = JSX <read $14_@7>{read item$10_@3}</read $14_@7>
72 - [14] Call mutate renderedItems$4_@2.push(read $15_@8)
73 - [15] Const mutate $16_@9 = Binary read renderedItems$4_@2.length >= read max$7_@5
74 - If (read $16_@9) then:bb2 else:bb10
69 + [18] Call mutate seen$5_@3.add(mutate item$10_@3)
70 + [19] Const mutate $14_@7 = "div"
71 + [20] Const mutate $15_@8 = JSX <read $14_@7>{read item$10_@3}</read $14_@7>
72 + [21] Call mutate renderedItems$4_@2.push(read $15_@8)
73 + [22] Const mutate $16_@9 = Binary read renderedItems$4_@2.length >= read max$7_@5
74 + [23] If (read $16_@9) then:bb2 else:bb10
75 bb10:
76 predecessor blocks: bb4
77 - Goto(Continue) bb1
77 + [24] Goto(Continue) bb1
78 bb2:
79 predecessor blocks: bb4 bb1
80 - [16] Const mutate count$17_@10 = read renderedItems$4_@2.length
81 - [17] Const mutate $18_@11 = "div"
82 - [18] Const mutate $19_@12 = "\n "
83 - [19] Const mutate $20_@13 = "h1"
84 - [20] Const mutate $21_@14 = " Items"
85 - [21] Const mutate $22_@15 = JSX <read $20_@13>{freeze count$17_@10}{read $21_@14}</read $20_@13>
86 - [22] Const mutate $23_@16 = "\n "
87 - [23] Const mutate $24_@17 = "\n "
88 - [24] Const mutate $25_@18 = JSX <read $18_@11>{read $19_@12}{read $22_@15}{read $23_@16}{freeze renderedItems$4_@2}{read $24_@17}</read $18_@11>
89 - Return read $25_@18
80 + [25] Const mutate count$17_@10 = read renderedItems$4_@2.length
81 + [26] Const mutate $18_@11 = "div"
82 + [27] Const mutate $19_@12 = "\n "
83 + [28] Const mutate $20_@13 = "h1"
84 + [29] Const mutate $21_@14 = " Items"
85 + [30] Const mutate $22_@15 = JSX <read $20_@13>{freeze count$17_@10}{read $21_@14}</read $20_@13>
86 + [31] Const mutate $23_@16 = "\n "
87 + [32] Const mutate $24_@17 = "\n "
88 + [33] Const mutate $25_@18 = JSX <read $18_@11>{read $19_@12}{read $22_@15}{read $23_@16}{freeze renderedItems$4_@2}{read $24_@17}</read $18_@11>
89 + [34] Return read $25_@18
90 ```
91
92 ### CFG
@@ -98,8 +98,8 @@ flowchart TB
98 bb0_instrs["
99 [1] Const mutate items$2_@0 = read props$1.items
100 [2] Const mutate maxItems$3_@1 = read props$1.maxItems
101 - [3] Const mutate renderedItems$4_@2[3:15] = Array []
102 - [4] Const mutate seen$5_@3[0:12] = New mutate Set$6_@3()
101 + [3] Const mutate renderedItems$4_@2[3:22] = Array []
102 + [4] Const mutate seen$5_@3[0:19] = New mutate Set$6_@3()
103 [5] Const mutate $9_@4 = 0
104 [6] Const mutate max$7_@5[0:7] = Call mutate Math$8_@5.max(read $9_@4, read maxItems$3_@1)
105 "]
@@ -110,20 +110,20 @@ flowchart TB
110 end
111 subgraph bb3
112 bb3_instrs["
113 - [7] Const mutate $11_@6 = null
114 - [8] Const mutate $12_@3[0:12] = Binary read item$10_@3 == read $11_@6
113 + [9] Const mutate $11_@6 = null
114 + [10] Const mutate $12_@3[0:19] = Binary read item$10_@3 == read $11_@6
115 "]
116 bb3_instrs --> bb3_terminal(["If (read $12_@3)"])
117 end
118 subgraph bb8
119 bb8_instrs["
120 - [9] Const mutate $13_@3[0:12] = read $12_@3
120 + [12] Const mutate $13_@3[0:19] = read $12_@3
121 "]
122 bb8_instrs --> bb8_terminal(["Goto"])
123 end
124 subgraph bb9
125 bb9_instrs["
126 - [10] Const mutate $13_@3[0:12] = Call mutate seen$5_@3.has(mutate item$10_@3)
126 + [14] Const mutate $13_@3[0:19] = Call mutate seen$5_@3.has(mutate item$10_@3)
127 "]
128 bb9_instrs --> bb9_terminal(["Goto"])
129 end
@@ -135,11 +135,11 @@ flowchart TB
135 end
136 subgraph bb4
137 bb4_instrs["
138 - [11] Call mutate seen$5_@3.add(mutate item$10_@3)
139 - [12] Const mutate $14_@7 = 'div'
140 - [13] Const mutate $15_@8 = JSX <read $14_@7>{read item$10_@3}</read $14_@7>
141 - [14] Call mutate renderedItems$4_@2.push(read $15_@8)
142 - [15] Const mutate $16_@9 = Binary read renderedItems$4_@2.length >= read max$7_@5
138 + [18] Call mutate seen$5_@3.add(mutate item$10_@3)
139 + [19] Const mutate $14_@7 = 'div'
140 + [20] Const mutate $15_@8 = JSX <read $14_@7>{read item$10_@3}</read $14_@7>
141 + [21] Call mutate renderedItems$4_@2.push(read $15_@8)
142 + [22] Const mutate $16_@9 = Binary read renderedItems$4_@2.length >= read max$7_@5
143 "]
144 bb4_instrs --> bb4_terminal(["If (read $16_@9)"])
145 end
@@ -148,15 +148,15 @@ flowchart TB
148 end
149 subgraph bb2
150 bb2_instrs["
151 - [16] Const mutate count$17_@10 = read renderedItems$4_@2.length
152 - [17] Const mutate $18_@11 = 'div'
153 - [18] Const mutate $19_@12 = '\n '
154 - [19] Const mutate $20_@13 = 'h1'
155 - [20] Const mutate $21_@14 = ' Items'
156 - [21] Const mutate $22_@15 = JSX <read $20_@13>{freeze count$17_@10}{read $21_@14}</read $20_@13>
157 - [22] Const mutate $23_@16 = '\n '
158 - [23] Const mutate $24_@17 = '\n '
159 - [24] Const mutate $25_@18 = JSX <read $18_@11>{read $19_@12}{read $22_@15}{read $23_@16}{freeze renderedItems$4_@2}{read $24_@17}</read $18_@11>
151 + [25] Const mutate count$17_@10 = read renderedItems$4_@2.length
152 + [26] Const mutate $18_@11 = 'div'
153 + [27] Const mutate $19_@12 = '\n '
154 + [28] Const mutate $20_@13 = 'h1'
155 + [29] Const mutate $21_@14 = ' Items'
156 + [30] Const mutate $22_@15 = JSX <read $20_@13>{freeze count$17_@10}{read $21_@14}</read $20_@13>
157 + [31] Const mutate $23_@16 = '\n '
158 + [32] Const mutate $24_@17 = '\n '
159 + [33] Const mutate $25_@18 = JSX <read $18_@11>{read $19_@12}{read $22_@15}{read $23_@16}{freeze renderedItems$4_@2}{read $24_@17}</read $18_@11>
160 "]
161 bb2_instrs --> bb2_terminal(["Return read $25_@18"])
162 end
compiler/forget/src/__tests__/fixtures/hir/conditional-break.expect.md
+47 -47
@@ -78,17 +78,17 @@ function Component(props) {
78
79 ```
80 bb0:
81 - [1] Const mutate a_DEBUG$2_@0[1:5] = Array []
81 + [1] Const mutate a_DEBUG$2_@0[1:7] = Array []
82 [2] Call mutate a_DEBUG$2_@0.push(read props$1.a)
83 - If (read props$1.b) then:bb2 else:bb1
83 + [3] If (read props$1.b) then:bb2 else:bb1
84 bb2:
85 predecessor blocks: bb0
86 - [3] Const mutate $3_@1 = null
87 - Return read $3_@1
86 + [4] Const mutate $3_@1 = null
87 + [5] Return read $3_@1
88 bb1:
89 predecessor blocks: bb0
90 - [4] Call mutate a_DEBUG$2_@0.push(read props$1.d)
91 - Return freeze a_DEBUG$2_@0
90 + [6] Call mutate a_DEBUG$2_@0.push(read props$1.d)
91 + [7] Return freeze a_DEBUG$2_@0
92 ```
93
94 ### CFG
@@ -98,20 +98,20 @@ flowchart TB
98 %% Basic Blocks
99 subgraph bb0
100 bb0_instrs["
101 - [1] Const mutate a_DEBUG$2_@0[1:5] = Array []
101 + [1] Const mutate a_DEBUG$2_@0[1:7] = Array []
102 [2] Call mutate a_DEBUG$2_@0.push(read props$1.a)
103 "]
104 bb0_instrs --> bb0_terminal(["If (read props$1.b)"])
105 end
106 subgraph bb2
107 bb2_instrs["
108 - [3] Const mutate $3_@1 = null
108 + [4] Const mutate $3_@1 = null
109 "]
110 bb2_instrs --> bb2_terminal(["Return read $3_@1"])
111 end
112 subgraph bb1
113 bb1_instrs["
114 - [4] Call mutate a_DEBUG$2_@0.push(read props$1.d)
114 + [6] Call mutate a_DEBUG$2_@0.push(read props$1.d)
115 "]
116 bb1_instrs --> bb1_terminal(["Return freeze a_DEBUG$2_@0"])
117 end
@@ -141,17 +141,17 @@ function Component$0(props$1) {
141
142 ```
143 bb0:
144 - [1] Const mutate a$2_@0[1:5] = Array []
144 + [1] Const mutate a$2_@0[1:7] = Array []
145 [2] Call mutate a$2_@0.push(read props$1.a)
146 - If (read props$1.b) then:bb2 else:bb1
146 + [3] If (read props$1.b) then:bb2 else:bb1
147 bb2:
148 predecessor blocks: bb0
149 - [3] Call mutate a$2_@0.push(read props$1.c)
150 - Goto bb1
149 + [4] Call mutate a$2_@0.push(read props$1.c)
150 + [5] Goto bb1
151 bb1:
152 predecessor blocks: bb2 bb0
153 - [4] Call mutate a$2_@0.push(read props$1.d)
154 - Return freeze a$2_@0
153 + [6] Call mutate a$2_@0.push(read props$1.d)
154 + [7] Return freeze a$2_@0
155 ```
156
157 ### CFG
@@ -161,20 +161,20 @@ flowchart TB
161 %% Basic Blocks
162 subgraph bb0
163 bb0_instrs["
164 - [1] Const mutate a$2_@0[1:5] = Array []
164 + [1] Const mutate a$2_@0[1:7] = Array []
165 [2] Call mutate a$2_@0.push(read props$1.a)
166 "]
167 bb0_instrs --> bb0_terminal(["If (read props$1.b)"])
168 end
169 subgraph bb2
170 bb2_instrs["
171 - [3] Call mutate a$2_@0.push(read props$1.c)
171 + [4] Call mutate a$2_@0.push(read props$1.c)
172 "]
173 bb2_instrs --> bb2_terminal(["Goto"])
174 end
175 subgraph bb1
176 bb1_instrs["
177 - [4] Call mutate a$2_@0.push(read props$1.d)
177 + [6] Call mutate a$2_@0.push(read props$1.d)
178 "]
179 bb1_instrs --> bb1_terminal(["Return freeze a$2_@0"])
180 end
@@ -205,18 +205,18 @@ function Component$0(props$1) {
205
206 ```
207 bb0:
208 - [1] Const mutate a$2_@0[1:6] = Array []
208 + [1] Const mutate a$2_@0[1:8] = Array []
209 [2] Call mutate a$2_@0.push(read props$1.a)
210 - If (read props$1.b) then:bb2 else:bb1
210 + [3] If (read props$1.b) then:bb2 else:bb1
211 bb2:
212 predecessor blocks: bb0
213 - [3] Call mutate a$2_@0.push(read props$1.c)
214 - [4] Const mutate $3_@1 = null
215 - Return read $3_@1
213 + [4] Call mutate a$2_@0.push(read props$1.c)
214 + [5] Const mutate $3_@1 = null
215 + [6] Return read $3_@1
216 bb1:
217 predecessor blocks: bb0
218 - [5] Call mutate a$2_@0.push(read props$1.d)
219 - Return freeze a$2_@0
218 + [7] Call mutate a$2_@0.push(read props$1.d)
219 + [8] Return freeze a$2_@0
220 ```
221
222 ### CFG
@@ -226,21 +226,21 @@ flowchart TB
226 %% Basic Blocks
227 subgraph bb0
228 bb0_instrs["
229 - [1] Const mutate a$2_@0[1:6] = Array []
229 + [1] Const mutate a$2_@0[1:8] = Array []
230 [2] Call mutate a$2_@0.push(read props$1.a)
231 "]
232 bb0_instrs --> bb0_terminal(["If (read props$1.b)"])
233 end
234 subgraph bb2
235 bb2_instrs["
236 - [3] Call mutate a$2_@0.push(read props$1.c)
237 - [4] Const mutate $3_@1 = null
236 + [4] Call mutate a$2_@0.push(read props$1.c)
237 + [5] Const mutate $3_@1 = null
238 "]
239 bb2_instrs --> bb2_terminal(["Return read $3_@1"])
240 end
241 subgraph bb1
242 bb1_instrs["
243 - [5] Call mutate a$2_@0.push(read props$1.d)
243 + [7] Call mutate a$2_@0.push(read props$1.d)
244 "]
245 bb1_instrs --> bb1_terminal(["Return freeze a$2_@0"])
246 end
@@ -271,17 +271,17 @@ function Component$0(props$1) {
271
272 ```
273 bb0:
274 - [1] Const mutate a$2_@0[1:5] = Array []
274 + [1] Const mutate a$2_@0[1:7] = Array []
275 [2] Call mutate a$2_@0.push(read props$1.a)
276 - If (read props$1.b) then:bb2 else:bb1
276 + [3] If (read props$1.b) then:bb2 else:bb1
277 bb2:
278 predecessor blocks: bb0
279 - [3] Call mutate a$2_@0.push(read props$1.c)
280 - Return freeze a$2_@0
279 + [4] Call mutate a$2_@0.push(read props$1.c)
280 + [5] Return freeze a$2_@0
281 bb1:
282 predecessor blocks: bb0
283 - [4] Call mutate a$2_@0.push(read props$1.d)
284 - Return freeze a$2_@0
283 + [6] Call mutate a$2_@0.push(read props$1.d)
284 + [7] Return freeze a$2_@0
285 ```
286
287 ### CFG
@@ -291,20 +291,20 @@ flowchart TB
291 %% Basic Blocks
292 subgraph bb0
293 bb0_instrs["
294 - [1] Const mutate a$2_@0[1:5] = Array []
294 + [1] Const mutate a$2_@0[1:7] = Array []
295 [2] Call mutate a$2_@0.push(read props$1.a)
296 "]
297 bb0_instrs --> bb0_terminal(["If (read props$1.b)"])
298 end
299 subgraph bb2
300 bb2_instrs["
301 - [3] Call mutate a$2_@0.push(read props$1.c)
301 + [4] Call mutate a$2_@0.push(read props$1.c)
302 "]
303 bb2_instrs --> bb2_terminal(["Return freeze a$2_@0"])
304 end
305 subgraph bb1
306 bb1_instrs["
307 - [4] Call mutate a$2_@0.push(read props$1.d)
307 + [6] Call mutate a$2_@0.push(read props$1.d)
308 "]
309 bb1_instrs --> bb1_terminal(["Return freeze a$2_@0"])
310 end
@@ -335,17 +335,17 @@ function Component$0(props$1) {
335
336 ```
337 bb0:
338 - [1] Const mutate a$2_@0[1:5] = Array []
338 + [1] Const mutate a$2_@0[1:7] = Array []
339 [2] Call mutate a$2_@0.push(read props$1.a)
340 - If (read props$1.b) then:bb1 else:bb2
340 + [3] If (read props$1.b) then:bb1 else:bb2
341 bb2:
342 predecessor blocks: bb0
343 - [3] Call mutate a$2_@0.push(read props$1.c)
344 - Goto bb1
343 + [4] Call mutate a$2_@0.push(read props$1.c)
344 + [5] Goto bb1
345 bb1:
346 predecessor blocks: bb0 bb2
347 - [4] Call mutate a$2_@0.push(read props$1.d)
348 - Return freeze a$2_@0
347 + [6] Call mutate a$2_@0.push(read props$1.d)
348 + [7] Return freeze a$2_@0
349 ```
350
351 ### CFG
@@ -355,20 +355,20 @@ flowchart TB
355 %% Basic Blocks
356 subgraph bb0
357 bb0_instrs["
358 - [1] Const mutate a$2_@0[1:5] = Array []
358 + [1] Const mutate a$2_@0[1:7] = Array []
359 [2] Call mutate a$2_@0.push(read props$1.a)
360 "]
361 bb0_instrs --> bb0_terminal(["If (read props$1.b)"])
362 end
363 subgraph bb2
364 bb2_instrs["
365 - [3] Call mutate a$2_@0.push(read props$1.c)
365 + [4] Call mutate a$2_@0.push(read props$1.c)
366 "]
367 bb2_instrs --> bb2_terminal(["Goto"])
368 end
369 subgraph bb1
370 bb1_instrs["
371 - [4] Call mutate a$2_@0.push(read props$1.d)
371 + [6] Call mutate a$2_@0.push(read props$1.d)
372 "]
373 bb1_instrs --> bb1_terminal(["Return freeze a$2_@0"])
374 end
compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md
+34 -34
@@ -67,24 +67,24 @@ function mayMutate() {}
67
68 ```
69 bb0:
70 - [1] Const mutate a$2_@0[1:4] = Array []
71 - [2] Const mutate b$3_@1[2:5] = Array []
72 - If (read b$3_@1) then:bb2 else:bb1
70 + [1] Const mutate a$2_@0[1:5] = Array []
71 + [2] Const mutate b$3_@1[2:8] = Array []
72 + [3] If (read b$3_@1) then:bb2 else:bb1
73 bb2:
74 predecessor blocks: bb0
75 - [3] Call mutate a$2_@0.push(read props$1.p0)
76 - Goto bb1
75 + [4] Call mutate a$2_@0.push(read props$1.p0)
76 + [5] Goto bb1
77 bb1:
78 predecessor blocks: bb2 bb0
79 - If (read props$1.p1) then:bb4 else:bb3
79 + [6] If (read props$1.p1) then:bb4 else:bb3
80 bb4:
81 predecessor blocks: bb1
82 - [4] Call mutate b$3_@1.push(read props$1.p2)
83 - Goto bb3
82 + [7] Call mutate b$3_@1.push(read props$1.p2)
83 + [8] Goto bb3
84 bb3:
85 predecessor blocks: bb4 bb1
86 - [5] Const mutate $5_@2 = JSX <read Foo$4 a={freeze a$2_@0} b={freeze b$3_@1} ></read Foo$4>
87 - Return read $5_@2
86 + [9] Const mutate $5_@2 = JSX <read Foo$4 a={freeze a$2_@0} b={freeze b$3_@1} ></read Foo$4>
87 + [10] Return read $5_@2
88 ```
89
90 ### CFG
@@ -94,14 +94,14 @@ flowchart TB
94 %% Basic Blocks
95 subgraph bb0
96 bb0_instrs["
97 - [1] Const mutate a$2_@0[1:4] = Array []
98 - [2] Const mutate b$3_@1[2:5] = Array []
97 + [1] Const mutate a$2_@0[1:5] = Array []
98 + [2] Const mutate b$3_@1[2:8] = Array []
99 "]
100 bb0_instrs --> bb0_terminal(["If (read b$3_@1)"])
101 end
102 subgraph bb2
103 bb2_instrs["
104 - [3] Call mutate a$2_@0.push(read props$1.p0)
104 + [4] Call mutate a$2_@0.push(read props$1.p0)
105 "]
106 bb2_instrs --> bb2_terminal(["Goto"])
107 end
@@ -110,13 +110,13 @@ flowchart TB
110 end
111 subgraph bb4
112 bb4_instrs["
113 - [4] Call mutate b$3_@1.push(read props$1.p2)
113 + [7] Call mutate b$3_@1.push(read props$1.p2)
114 "]
115 bb4_instrs --> bb4_terminal(["Goto"])
116 end
117 subgraph bb3
118 bb3_instrs["
119 - [5] Const mutate $5_@2 = JSX <read Foo$4 a={freeze a$2_@0} b={freeze b$3_@1} ></read Foo$4>
119 + [9] Const mutate $5_@2 = JSX <read Foo$4 a={freeze a$2_@0} b={freeze b$3_@1} ></read Foo$4>
120 "]
121 bb3_instrs --> bb3_terminal(["Return read $5_@2"])
122 end
@@ -153,25 +153,25 @@ function Component$0(props$1) {
153
154 ```
155 bb0:
156 - [1] Const mutate a$2_@0[1:5] = Array []
157 - [2] Const mutate b$3_@1[0:6] = Array []
158 - [3] Const mutate $5_@1[0:6] = Call mutate mayMutate$4_@1(mutate b$3_@1)
159 - If (read $5_@1) then:bb2 else:bb1
156 + [1] Const mutate a$2_@0[1:6] = Array []
157 + [2] Const mutate b$3_@1[0:9] = Array []
158 + [3] Const mutate $5_@1[0:9] = Call mutate mayMutate$4_@1(mutate b$3_@1)
159 + [4] If (read $5_@1) then:bb2 else:bb1
160 bb2:
161 predecessor blocks: bb0
162 - [4] Call mutate a$2_@0.push(read props$1.p0)
163 - Goto bb1
162 + [5] Call mutate a$2_@0.push(read props$1.p0)
163 + [6] Goto bb1
164 bb1:
165 predecessor blocks: bb2 bb0
166 - If (read props$1.p1) then:bb4 else:bb3
166 + [7] If (read props$1.p1) then:bb4 else:bb3
167 bb4:
168 predecessor blocks: bb1
169 - [5] Call mutate b$3_@1.push(read props$1.p2)
170 - Goto bb3
169 + [8] Call mutate b$3_@1.push(read props$1.p2)
170 + [9] Goto bb3
171 bb3:
172 predecessor blocks: bb4 bb1
173 - [6] Const mutate $7_@2 = JSX <read Foo$6 a={freeze a$2_@0} b={freeze b$3_@1} ></read Foo$6>
174 - Return read $7_@2
173 + [10] Const mutate $7_@2 = JSX <read Foo$6 a={freeze a$2_@0} b={freeze b$3_@1} ></read Foo$6>
174 + [11] Return read $7_@2
175 ```
176
177 ### CFG
@@ -181,15 +181,15 @@ flowchart TB
181 %% Basic Blocks
182 subgraph bb0
183 bb0_instrs["
184 - [1] Const mutate a$2_@0[1:5] = Array []
185 - [2] Const mutate b$3_@1[0:6] = Array []
186 - [3] Const mutate $5_@1[0:6] = Call mutate mayMutate$4_@1(mutate b$3_@1)
184 + [1] Const mutate a$2_@0[1:6] = Array []
185 + [2] Const mutate b$3_@1[0:9] = Array []
186 + [3] Const mutate $5_@1[0:9] = Call mutate mayMutate$4_@1(mutate b$3_@1)
187 "]
188 bb0_instrs --> bb0_terminal(["If (read $5_@1)"])
189 end
190 subgraph bb2
191 bb2_instrs["
192 - [4] Call mutate a$2_@0.push(read props$1.p0)
192 + [5] Call mutate a$2_@0.push(read props$1.p0)
193 "]
194 bb2_instrs --> bb2_terminal(["Goto"])
195 end
@@ -198,13 +198,13 @@ flowchart TB
198 end
199 subgraph bb4
200 bb4_instrs["
201 - [5] Call mutate b$3_@1.push(read props$1.p2)
201 + [8] Call mutate b$3_@1.push(read props$1.p2)
202 "]
203 bb4_instrs --> bb4_terminal(["Goto"])
204 end
205 subgraph bb3
206 bb3_instrs["
207 - [6] Const mutate $7_@2 = JSX <read Foo$6 a={freeze a$2_@0} b={freeze b$3_@1} ></read Foo$6>
207 + [10] Const mutate $7_@2 = JSX <read Foo$6 a={freeze a$2_@0} b={freeze b$3_@1} ></read Foo$6>
208 "]
209 bb3_instrs --> bb3_terminal(["Return read $7_@2"])
210 end
@@ -241,7 +241,7 @@ function Component$0(props$1) {
241
242 ```
243 bb0:
244 - Return
244 + [1] Return
245 ```
246
247 ### CFG
@@ -269,7 +269,7 @@ function Foo$0() {
269
270 ```
271 bb0:
272 - Return
272 + [1] Return
273 ```
274
275 ### CFG
compiler/forget/src/__tests__/fixtures/hir/constructor.expect.md
+2 -2
@@ -19,7 +19,7 @@ function Component(props) {
19
20 ```
21 bb0:
22 - Return
22 + [1] Return
23 ```
24
25 ### CFG
@@ -55,7 +55,7 @@ bb0:
55 [6] New mutate Foo$4_@0(mutate b$3_@0)
56 [7] Const mutate $7_@3 = "div"
57 [8] Const mutate $8_@4 = JSX <read $7_@3 a={read a$2_@0} b={freeze b$3_@0} ></read $7_@3>
58 - Return read $8_@4
58 + [9] Return read $8_@4
59 ```
60
61 ### CFG
compiler/forget/src/__tests__/fixtures/hir/frozen-after-alias.expect.md
+3 -3
@@ -22,7 +22,7 @@ bb0:
22 [2] Const mutate b$2_@0[1:3] = read a$1_@0
23 [3] Call read useFreeze$3(freeze a$1_@0)
24 [4] Call mutate foo$4_@1(read b$2_@0)
25 - Return
25 + [5] Return
26 ```
27
28 ### CFG
@@ -60,7 +60,7 @@ function Component$0() {
60
61 ```
62 bb0:
63 - Return
63 + [1] Return
64 ```
65
66 ### CFG
@@ -88,7 +88,7 @@ function useFreeze$0() {
88
89 ```
90 bb0:
91 - Return
91 + [1] Return
92 ```
93
94 ### CFG
compiler/forget/src/__tests__/fixtures/hir/hook-call.expect.md
+3 -3
@@ -23,7 +23,7 @@ function Component(props) {
23
24 ```
25 bb0:
26 - Return
26 + [1] Return
27 ```
28
29 ### CFG
@@ -51,7 +51,7 @@ function useFreeze$0() {
51
52 ```
53 bb0:
54 - Return
54 + [1] Return
55 ```
56
57 ### CFG
@@ -86,7 +86,7 @@ bb0:
86 [5] Const mutate $7_@4 = "\n "
87 [6] Const mutate $8_@5 = "\n "
88 [7] Const mutate $9_@6 = JSX <read Component$0>{read $6_@3}{read x$2_@0}{read $7_@4}{read y$3_@1}{read $8_@5}</read Component$0>
89 - Return read $9_@6
89 + [8] Return read $9_@6
90 ```
91
92 ### CFG
compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-arguments.expect.md
+3 -3
@@ -23,7 +23,7 @@ bb0:
23 [2] Call read useFreeze$2(freeze a$1_@0)
24 [3] Call read useFreeze$2(read a$1_@0)
25 [4] Call mutate call$3_@1(read a$1_@0)
26 - Return read a$1_@0
26 + [5] Return read a$1_@0
27 ```
28
29 ### CFG
@@ -61,7 +61,7 @@ function Component$0() {
61
62 ```
63 bb0:
64 - Return
64 + [1] Return
65 ```
66
67 ### CFG
@@ -89,7 +89,7 @@ function useFreeze$0(x$1) {
89
90 ```
91 bb0:
92 - Return
92 + [1] Return
93 ```
94
95 ### CFG
compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-possibly-mutable-arguments.expect.md
+18 -18
@@ -27,23 +27,23 @@ function call(x) {}
27 ```
28 bb0:
29 [1] Const mutate cond$2_@0 = read props$1.cond
30 - [2] Const mutate x$3_@1[2:6] = read props$1.x
30 + [2] Const mutate x$3_@1[2:8] = read props$1.x
31 [3] Let mutate a$4_@2 = undefined
32 - If (read cond$2_@0) then:bb2 else:bb3
32 + [4] If (read cond$2_@0) then:bb2 else:bb3
33 bb2:
34 predecessor blocks: bb0
35 - [4] Reassign mutate a$4_@1[2:6] = read x$3_@1
36 - Goto bb1
35 + [5] Reassign mutate a$4_@1[2:8] = read x$3_@1
36 + [6] Goto bb1
37 bb3:
38 predecessor blocks: bb0
39 - [5] Reassign mutate a$4_@1[2:6] = Array []
40 - Goto bb1
39 + [7] Reassign mutate a$4_@1[2:8] = Array []
40 + [8] Goto bb1
41 bb1:
42 predecessor blocks: bb2 bb3
43 - [6] Call read useFreeze$5(freeze a$4_@1)
44 - [7] Call read useFreeze$5(read a$4_@1)
45 - [8] Call mutate call$6_@3(read a$4_@1)
46 - Return read a$4_@1
43 + [9] Call read useFreeze$5(freeze a$4_@1)
44 + [10] Call read useFreeze$5(read a$4_@1)
45 + [11] Call mutate call$6_@3(read a$4_@1)
46 + [12] Return read a$4_@1
47 ```
48
49 ### CFG
@@ -54,28 +54,28 @@ flowchart TB
54 subgraph bb0
55 bb0_instrs["
56 [1] Const mutate cond$2_@0 = read props$1.cond
57 - [2] Const mutate x$3_@1[2:6] = read props$1.x
57 + [2] Const mutate x$3_@1[2:8] = read props$1.x
58 [3] Let mutate a$4_@2 = undefined
59 "]
60 bb0_instrs --> bb0_terminal(["If (read cond$2_@0)"])
61 end
62 subgraph bb2
63 bb2_instrs["
64 - [4] Reassign mutate a$4_@1[2:6] = read x$3_@1
64 + [5] Reassign mutate a$4_@1[2:8] = read x$3_@1
65 "]
66 bb2_instrs --> bb2_terminal(["Goto"])
67 end
68 subgraph bb3
69 bb3_instrs["
70 - [5] Reassign mutate a$4_@1[2:6] = Array []
70 + [7] Reassign mutate a$4_@1[2:8] = Array []
71 "]
72 bb3_instrs --> bb3_terminal(["Goto"])
73 end
74 subgraph bb1
75 bb1_instrs["
76 - [6] Call read useFreeze$5(freeze a$4_@1)
77 - [7] Call read useFreeze$5(read a$4_@1)
78 - [8] Call mutate call$6_@3(read a$4_@1)
76 + [9] Call read useFreeze$5(freeze a$4_@1)
77 + [10] Call read useFreeze$5(read a$4_@1)
78 + [11] Call mutate call$6_@3(read a$4_@1)
79 "]
80 bb1_instrs --> bb1_terminal(["Return read a$4_@1"])
81 end
@@ -113,7 +113,7 @@ function Component$0(props$1) {
113
114 ```
115 bb0:
116 - Return
116 + [1] Return
117 ```
118
119 ### CFG
@@ -141,7 +141,7 @@ function useFreeze$0(x$1) {
141
142 ```
143 bb0:
144 - Return
144 + [1] Return
145 ```
146
147 ### CFG
compiler/forget/src/__tests__/fixtures/hir/independent-across-if.expect.md
+17 -17
@@ -37,7 +37,7 @@ function Component(props) {
37
38 ```
39 bb0:
40 - Return
40 + [1] Return
41 ```
42
43 ### CFG
@@ -65,7 +65,7 @@ function compute$0() {
65
66 ```
67 bb0:
68 - Return
68 + [1] Return
69 ```
70
71 ### CFG
@@ -93,7 +93,7 @@ function mutate$0() {
93
94 ```
95 bb0:
96 - Return
96 + [1] Return
97 ```
98
99 ### CFG
@@ -121,7 +121,7 @@ function foo$0() {
121
122 ```
123 bb0:
124 - Return
124 + [1] Return
125 ```
126
127 ### CFG
@@ -149,18 +149,18 @@ function Foo$0() {
149
150 ```
151 bb0:
152 - [1] Const mutate a$2_@0[0:5] = Call mutate compute$3_@0(read props$1.a)
153 - [2] Const mutate b$4_@0[0:5] = Call mutate compute$3_@0(read props$1.b)
154 - If (read props$1.c) then:bb2 else:bb1
152 + [1] Const mutate a$2_@0[0:6] = Call mutate compute$3_@0(read props$1.a)
153 + [2] Const mutate b$4_@0[0:6] = Call mutate compute$3_@0(read props$1.b)
154 + [3] If (read props$1.c) then:bb2 else:bb1
155 bb2:
156 predecessor blocks: bb0
157 - [3] Call mutate mutate$5_@0(mutate a$2_@0)
158 - [4] Call mutate mutate$5_@0(mutate b$4_@0)
159 - Goto bb1
157 + [4] Call mutate mutate$5_@0(mutate a$2_@0)
158 + [5] Call mutate mutate$5_@0(mutate b$4_@0)
159 + [6] Goto bb1
160 bb1:
161 predecessor blocks: bb2 bb0
162 - [5] Const mutate $7_@1 = JSX <read Foo$6 a={freeze a$2_@0} b={freeze b$4_@0} ></read Foo$6>
163 - Return read $7_@1
162 + [7] Const mutate $7_@1 = JSX <read Foo$6 a={freeze a$2_@0} b={freeze b$4_@0} ></read Foo$6>
163 + [8] Return read $7_@1
164 ```
165
166 ### CFG
@@ -170,21 +170,21 @@ flowchart TB
170 %% Basic Blocks
171 subgraph bb0
172 bb0_instrs["
173 - [1] Const mutate a$2_@0[0:5] = Call mutate compute$3_@0(read props$1.a)
174 - [2] Const mutate b$4_@0[0:5] = Call mutate compute$3_@0(read props$1.b)
173 + [1] Const mutate a$2_@0[0:6] = Call mutate compute$3_@0(read props$1.a)
174 + [2] Const mutate b$4_@0[0:6] = Call mutate compute$3_@0(read props$1.b)
175 "]
176 bb0_instrs --> bb0_terminal(["If (read props$1.c)"])
177 end
178 subgraph bb2
179 bb2_instrs["
180 - [3] Call mutate mutate$5_@0(mutate a$2_@0)
181 - [4] Call mutate mutate$5_@0(mutate b$4_@0)
180 + [4] Call mutate mutate$5_@0(mutate a$2_@0)
181 + [5] Call mutate mutate$5_@0(mutate b$4_@0)
182 "]
183 bb2_instrs --> bb2_terminal(["Goto"])
184 end
185 subgraph bb1
186 bb1_instrs["
187 - [5] Const mutate $7_@1 = JSX <read Foo$6 a={freeze a$2_@0} b={freeze b$4_@0} ></read Foo$6>
187 + [7] Const mutate $7_@1 = JSX <read Foo$6 a={freeze a$2_@0} b={freeze b$4_@0} ></read Foo$6>
188 "]
189 bb1_instrs --> bb1_terminal(["Return read $7_@1"])
190 end
compiler/forget/src/__tests__/fixtures/hir/independent.expect.md
+4 -4
@@ -31,7 +31,7 @@ bb0:
31 [1] Const mutate a$2_@0[0:3] = Call mutate compute$3_@0(read props$1.a)
32 [2] Const mutate b$4_@0[0:3] = Call mutate compute$3_@0(read props$1.b)
33 [3] Const mutate $6_@1 = JSX <read Foo$5 a={freeze a$2_@0} b={freeze b$4_@0} ></read Foo$5>
34 - Return read $6_@1
34 + [4] Return read $6_@1
35 ```
36
37 ### CFG
@@ -66,7 +66,7 @@ function Component$0(props$1) {
66
67 ```
68 bb0:
69 - Return
69 + [1] Return
70 ```
71
72 ### CFG
@@ -94,7 +94,7 @@ function compute$0() {
94
95 ```
96 bb0:
97 - Return
97 + [1] Return
98 ```
99
100 ### CFG
@@ -122,7 +122,7 @@ function foo$0() {
122
123 ```
124 bb0:
125 - Return
125 + [1] Return
126 ```
127
128 ### CFG
compiler/forget/src/__tests__/fixtures/hir/interdependent-across-if.expect.md
+14 -14
@@ -31,7 +31,7 @@ function Component(props) {
31
32 ```
33 bb0:
34 - Return
34 + [1] Return
35 ```
36
37 ### CFG
@@ -59,7 +59,7 @@ function compute$0() {
59
60 ```
61 bb0:
62 - Return
62 + [1] Return
63 ```
64
65 ### CFG
@@ -87,7 +87,7 @@ function foo$0() {
87
88 ```
89 bb0:
90 - Return
90 + [1] Return
91 ```
92
93 ### CFG
@@ -115,17 +115,17 @@ function Foo$0() {
115
116 ```
117 bb0:
118 - [1] Const mutate a$2_@0[0:4] = Call mutate compute$3_@0(read props$1.a)
119 - [2] Const mutate b$4_@0[0:4] = Call mutate compute$3_@0(read props$1.b)
120 - If (read props$1.c) then:bb2 else:bb1
118 + [1] Const mutate a$2_@0[0:5] = Call mutate compute$3_@0(read props$1.a)
119 + [2] Const mutate b$4_@0[0:5] = Call mutate compute$3_@0(read props$1.b)
120 + [3] If (read props$1.c) then:bb2 else:bb1
121 bb2:
122 predecessor blocks: bb0
123 - [3] Call mutate foo$5_@0(mutate a$2_@0, mutate b$4_@0)
124 - Goto bb1
123 + [4] Call mutate foo$5_@0(mutate a$2_@0, mutate b$4_@0)
124 + [5] Goto bb1
125 bb1:
126 predecessor blocks: bb2 bb0
127 - [4] Const mutate $7_@1 = JSX <read Foo$6 a={freeze a$2_@0} b={freeze b$4_@0} ></read Foo$6>
128 - Return read $7_@1
127 + [6] Const mutate $7_@1 = JSX <read Foo$6 a={freeze a$2_@0} b={freeze b$4_@0} ></read Foo$6>
128 + [7] Return read $7_@1
129 ```
130
131 ### CFG
@@ -135,20 +135,20 @@ flowchart TB
135 %% Basic Blocks
136 subgraph bb0
137 bb0_instrs["
138 - [1] Const mutate a$2_@0[0:4] = Call mutate compute$3_@0(read props$1.a)
139 - [2] Const mutate b$4_@0[0:4] = Call mutate compute$3_@0(read props$1.b)
138 + [1] Const mutate a$2_@0[0:5] = Call mutate compute$3_@0(read props$1.a)
139 + [2] Const mutate b$4_@0[0:5] = Call mutate compute$3_@0(read props$1.b)
140 "]
141 bb0_instrs --> bb0_terminal(["If (read props$1.c)"])
142 end
143 subgraph bb2
144 bb2_instrs["
145 - [3] Call mutate foo$5_@0(mutate a$2_@0, mutate b$4_@0)
145 + [4] Call mutate foo$5_@0(mutate a$2_@0, mutate b$4_@0)
146 "]
147 bb2_instrs --> bb2_terminal(["Goto"])
148 end
149 subgraph bb1
150 bb1_instrs["
151 - [4] Const mutate $7_@1 = JSX <read Foo$6 a={freeze a$2_@0} b={freeze b$4_@0} ></read Foo$6>
151 + [6] Const mutate $7_@1 = JSX <read Foo$6 a={freeze a$2_@0} b={freeze b$4_@0} ></read Foo$6>
152 "]
153 bb1_instrs --> bb1_terminal(["Return read $7_@1"])
154 end
compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md
+4 -4
@@ -32,7 +32,7 @@ bb0:
32 [2] Const mutate b$4_@0[0:4] = Call mutate compute$3_@0(read props$1.b)
33 [3] Call mutate foo$5_@0(mutate a$2_@0, mutate b$4_@0)
34 [4] Const mutate $7_@1 = JSX <read Foo$6 a={freeze a$2_@0} b={freeze b$4_@0} ></read Foo$6>
35 - Return read $7_@1
35 + [5] Return read $7_@1
36 ```
37
38 ### CFG
@@ -69,7 +69,7 @@ function Component$0(props$1) {
69
70 ```
71 bb0:
72 - Return
72 + [1] Return
73 ```
74
75 ### CFG
@@ -97,7 +97,7 @@ function compute$0() {
97
98 ```
99 bb0:
100 - Return
100 + [1] Return
101 ```
102
103 ### CFG
@@ -125,7 +125,7 @@ function foo$0() {
125
126 ```
127 bb0:
128 - Return
128 + [1] Return
129 ```
130
131 ### CFG
compiler/forget/src/__tests__/fixtures/hir/jsx-fragment.expect.md
+1 -1
@@ -30,7 +30,7 @@ bb0:
30 [9] Const mutate $10_@8 = JSX <read $5_@3>{read $6_@4}{read $8_@6}{read $9_@7}</read $5_@3>
31 [10] Const mutate $11_@9 = "\n "
32 [11] Const mutate $12_@10 = JsxFragment [read $2_@0, read props$1.greeting, read $3_@1, read $4_@2, read $10_@8, read $11_@9]
33 - Return read $12_@10
33 + [12] Return read $12_@10
34 ```
35
36 ### CFG
compiler/forget/src/__tests__/fixtures/hir/logical-expression.expect.md
+34 -34
@@ -23,19 +23,19 @@ function g() {}
23
24 ```
25 bb0:
26 - [1] Const mutate $2_@0[0:4] = Call mutate f$1_@0()
27 - If (read $2_@0) then:bb2 else:bb3
26 + [1] Const mutate $2_@0[0:6] = Call mutate f$1_@0()
27 + [2] If (read $2_@0) then:bb2 else:bb3
28 bb2:
29 predecessor blocks: bb0
30 - [2] Const mutate $3_@0[0:4] = Call mutate g$4_@0()
31 - Goto bb1
30 + [3] Const mutate $3_@0[0:6] = Call mutate g$4_@0()
31 + [4] Goto bb1
32 bb3:
33 predecessor blocks: bb0
34 - [3] Const mutate $3_@0[0:4] = read $2_@0
35 - Goto bb1
34 + [5] Const mutate $3_@0[0:6] = read $2_@0
35 + [6] Goto bb1
36 bb1:
37 predecessor blocks: bb2 bb3
38 - Return freeze $3_@0
38 + [7] Return freeze $3_@0
39 ```
40
41 ### CFG
@@ -45,19 +45,19 @@ flowchart TB
45 %% Basic Blocks
46 subgraph bb0
47 bb0_instrs["
48 - [1] Const mutate $2_@0[0:4] = Call mutate f$1_@0()
48 + [1] Const mutate $2_@0[0:6] = Call mutate f$1_@0()
49 "]
50 bb0_instrs --> bb0_terminal(["If (read $2_@0)"])
51 end
52 subgraph bb2
53 bb2_instrs["
54 - [2] Const mutate $3_@0[0:4] = Call mutate g$4_@0()
54 + [3] Const mutate $3_@0[0:6] = Call mutate g$4_@0()
55 "]
56 bb2_instrs --> bb2_terminal(["Goto"])
57 end
58 subgraph bb3
59 bb3_instrs["
60 - [3] Const mutate $3_@0[0:4] = read $2_@0
60 + [5] Const mutate $3_@0[0:6] = read $2_@0
61 "]
62 bb3_instrs --> bb3_terminal(["Goto"])
63 end
@@ -89,19 +89,19 @@ function And$0() {
89
90 ```
91 bb0:
92 - [1] Const mutate $2_@0[0:4] = Call mutate f$1_@0()
93 - If (read $2_@0) then:bb2 else:bb3
92 + [1] Const mutate $2_@0[0:6] = Call mutate f$1_@0()
93 + [2] If (read $2_@0) then:bb2 else:bb3
94 bb2:
95 predecessor blocks: bb0
96 - [2] Const mutate $3_@0[0:4] = read $2_@0
97 - Goto bb1
96 + [3] Const mutate $3_@0[0:6] = read $2_@0
97 + [4] Goto bb1
98 bb3:
99 predecessor blocks: bb0
100 - [3] Const mutate $3_@0[0:4] = Call mutate g$4_@0()
101 - Goto bb1
100 + [5] Const mutate $3_@0[0:6] = Call mutate g$4_@0()
101 + [6] Goto bb1
102 bb1:
103 predecessor blocks: bb2 bb3
104 - Return freeze $3_@0
104 + [7] Return freeze $3_@0
105 ```
106
107 ### CFG
@@ -111,19 +111,19 @@ flowchart TB
111 %% Basic Blocks
112 subgraph bb0
113 bb0_instrs["
114 - [1] Const mutate $2_@0[0:4] = Call mutate f$1_@0()
114 + [1] Const mutate $2_@0[0:6] = Call mutate f$1_@0()
115 "]
116 bb0_instrs --> bb0_terminal(["If (read $2_@0)"])
117 end
118 subgraph bb2
119 bb2_instrs["
120 - [2] Const mutate $3_@0[0:4] = read $2_@0
120 + [3] Const mutate $3_@0[0:6] = read $2_@0
121 "]
122 bb2_instrs --> bb2_terminal(["Goto"])
123 end
124 subgraph bb3
125 bb3_instrs["
126 - [3] Const mutate $3_@0[0:4] = Call mutate g$4_@0()
126 + [5] Const mutate $3_@0[0:6] = Call mutate g$4_@0()
127 "]
128 bb3_instrs --> bb3_terminal(["Goto"])
129 end
@@ -155,21 +155,21 @@ function Or$0() {
155
156 ```
157 bb0:
158 - [1] Const mutate $3_@0[0:6] = Call mutate f$2_@0()
158 + [1] Const mutate $3_@0[0:8] = Call mutate f$2_@0()
159 [2] Const mutate $4_@1 = null
160 - [3] Const mutate $5_@0[0:6] = Binary read $3_@0 != read $4_@1
161 - If (read $5_@0) then:bb2 else:bb3
160 + [3] Const mutate $5_@0[0:8] = Binary read $3_@0 != read $4_@1
161 + [4] If (read $5_@0) then:bb2 else:bb3
162 bb2:
163 predecessor blocks: bb0
164 - [4] Const mutate $6_@0[0:6] = read $3_@0
165 - Goto bb1
164 + [5] Const mutate $6_@0[0:8] = read $3_@0
165 + [6] Goto bb1
166 bb3:
167 predecessor blocks: bb0
168 - [5] Const mutate $6_@0[0:6] = Call mutate g$7_@0()
169 - Goto bb1
168 + [7] Const mutate $6_@0[0:8] = Call mutate g$7_@0()
169 + [8] Goto bb1
170 bb1:
171 predecessor blocks: bb2 bb3
172 - Return freeze $6_@0
172 + [9] Return freeze $6_@0
173 ```
174
175 ### CFG
@@ -179,21 +179,21 @@ flowchart TB
179 %% Basic Blocks
180 subgraph bb0
181 bb0_instrs["
182 - [1] Const mutate $3_@0[0:6] = Call mutate f$2_@0()
182 + [1] Const mutate $3_@0[0:8] = Call mutate f$2_@0()
183 [2] Const mutate $4_@1 = null
184 - [3] Const mutate $5_@0[0:6] = Binary read $3_@0 != read $4_@1
184 + [3] Const mutate $5_@0[0:8] = Binary read $3_@0 != read $4_@1
185 "]
186 bb0_instrs --> bb0_terminal(["If (read $5_@0)"])
187 end
188 subgraph bb2
189 bb2_instrs["
190 - [4] Const mutate $6_@0[0:6] = read $3_@0
190 + [5] Const mutate $6_@0[0:8] = read $3_@0
191 "]
192 bb2_instrs --> bb2_terminal(["Goto"])
193 end
194 subgraph bb3
195 bb3_instrs["
196 - [5] Const mutate $6_@0[0:6] = Call mutate g$7_@0()
196 + [7] Const mutate $6_@0[0:8] = Call mutate g$7_@0()
197 "]
198 bb3_instrs --> bb3_terminal(["Goto"])
199 end
@@ -225,7 +225,7 @@ function QuestionQuestion$0(props$1) {
225
226 ```
227 bb0:
228 - Return
228 + [1] Return
229 ```
230
231 ### CFG
@@ -253,7 +253,7 @@ function f$0() {
253
254 ```
255 bb0:
256 - Return
256 + [1] Return
257 ```
258
259 ### CFG
compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md
+39 -39
@@ -43,7 +43,7 @@ function Component(props) {
43
44 ```
45 bb0:
46 - Return
46 + [1] Return
47 ```
48
49 ### CFG
@@ -71,7 +71,7 @@ function mutate$0(x$1, y$2) {
71
72 ```
73 bb0:
74 - Return
74 + [1] Return
75 ```
76
77 ### CFG
@@ -99,45 +99,45 @@ function cond$0(x$1) {
99
100 ```
101 bb0:
102 - [1] Let mutate a$2_@0[0:15] = Object { }
103 - [2] Let mutate b$3_@0[0:15] = Object { }
104 - [3] Let mutate c$4_@0[0:15] = Object { }
105 - [4] Let mutate d$5_@0[0:15] = Object { }
106 - While test=bb1 loop=bb3 fallthrough=bb2
102 + [1] Let mutate a$2_@0[0:23] = Object { }
103 + [2] Let mutate b$3_@0[0:23] = Object { }
104 + [3] Let mutate c$4_@0[0:23] = Object { }
105 + [4] Let mutate d$5_@0[0:23] = Object { }
106 + [5] While test=bb1 loop=bb3 fallthrough=bb2
107 bb1:
108 predecessor blocks: bb0 bb4
109 - [5] Const mutate $10_@1 = true
110 - If (read $10_@1) then:bb3 else:bb2
109 + [6] Const mutate $10_@1 = true
110 + [7] If (read $10_@1) then:bb3 else:bb2
111 bb3:
112 predecessor blocks: bb1
113 - [6] Let mutate z$6_@0[0:15] = read a$2_@0
114 - [7] Reassign mutate a$2_@0[0:15] = read b$3_@0
115 - [8] Reassign mutate b$3_@0[0:15] = read c$4_@0
116 - [9] Reassign mutate c$4_@0[0:15] = read d$5_@0
117 - [10] Reassign mutate d$5_@0[0:15] = read z$6_@0
118 - [11] Call mutate mutate$7_@0(mutate a$2_@0, mutate b$3_@0)
119 - [12] Const mutate $9_@0[0:15] = Call mutate cond$8_@0(mutate a$2_@0)
120 - If (read $9_@0) then:bb2 else:bb4
113 + [8] Let mutate z$6_@0[0:23] = read a$2_@0
114 + [9] Reassign mutate a$2_@0[0:23] = read b$3_@0
115 + [10] Reassign mutate b$3_@0[0:23] = read c$4_@0
116 + [11] Reassign mutate c$4_@0[0:23] = read d$5_@0
117 + [12] Reassign mutate d$5_@0[0:23] = read z$6_@0
118 + [13] Call mutate mutate$7_@0(mutate a$2_@0, mutate b$3_@0)
119 + [14] Const mutate $9_@0[0:23] = Call mutate cond$8_@0(mutate a$2_@0)
120 + [15] If (read $9_@0) then:bb2 else:bb4
121 bb4:
122 predecessor blocks: bb3
123 - Goto(Continue) bb1
123 + [16] Goto(Continue) bb1
124 bb2:
125 predecessor blocks: bb3 bb1
126 - If (read a$2_@0) then:bb7 else:bb7
126 + [17] If (read a$2_@0) then:bb7 else:bb7
127 bb7:
128 predecessor blocks: bb2
129 - If (read b$3_@0) then:bb9 else:bb9
129 + [18] If (read b$3_@0) then:bb9 else:bb9
130 bb9:
131 predecessor blocks: bb7
132 - If (read c$4_@0) then:bb11 else:bb11
132 + [19] If (read c$4_@0) then:bb11 else:bb11
133 bb11:
134 predecessor blocks: bb9
135 - If (read d$5_@0) then:bb13 else:bb13
135 + [20] If (read d$5_@0) then:bb13 else:bb13
136 bb13:
137 predecessor blocks: bb11
138 - [13] Const mutate $11_@2 = null
139 - [14] Call mutate mutate$7_@0(mutate d$5_@0, read $11_@2)
140 - Return
138 + [21] Const mutate $11_@2 = null
139 + [22] Call mutate mutate$7_@0(mutate d$5_@0, read $11_@2)
140 + [23] Return
141 ```
142
143 ### CFG
@@ -147,28 +147,28 @@ flowchart TB
147 %% Basic Blocks
148 subgraph bb0
149 bb0_instrs["
150 - [1] Let mutate a$2_@0[0:15] = Object { }
151 - [2] Let mutate b$3_@0[0:15] = Object { }
152 - [3] Let mutate c$4_@0[0:15] = Object { }
153 - [4] Let mutate d$5_@0[0:15] = Object { }
150 + [1] Let mutate a$2_@0[0:23] = Object { }
151 + [2] Let mutate b$3_@0[0:23] = Object { }
152 + [3] Let mutate c$4_@0[0:23] = Object { }
153 + [4] Let mutate d$5_@0[0:23] = Object { }
154 "]
155 bb0_instrs --> bb0_terminal(["While"])
156 end
157 subgraph bb1
158 bb1_instrs["
159 - [5] Const mutate $10_@1 = true
159 + [6] Const mutate $10_@1 = true
160 "]
161 bb1_instrs --> bb1_terminal(["If (read $10_@1)"])
162 end
163 subgraph bb3
164 bb3_instrs["
165 - [6] Let mutate z$6_@0[0:15] = read a$2_@0
166 - [7] Reassign mutate a$2_@0[0:15] = read b$3_@0
167 - [8] Reassign mutate b$3_@0[0:15] = read c$4_@0
168 - [9] Reassign mutate c$4_@0[0:15] = read d$5_@0
169 - [10] Reassign mutate d$5_@0[0:15] = read z$6_@0
170 - [11] Call mutate mutate$7_@0(mutate a$2_@0, mutate b$3_@0)
171 - [12] Const mutate $9_@0[0:15] = Call mutate cond$8_@0(mutate a$2_@0)
165 + [8] Let mutate z$6_@0[0:23] = read a$2_@0
166 + [9] Reassign mutate a$2_@0[0:23] = read b$3_@0
167 + [10] Reassign mutate b$3_@0[0:23] = read c$4_@0
168 + [11] Reassign mutate c$4_@0[0:23] = read d$5_@0
169 + [12] Reassign mutate d$5_@0[0:23] = read z$6_@0
170 + [13] Call mutate mutate$7_@0(mutate a$2_@0, mutate b$3_@0)
171 + [14] Const mutate $9_@0[0:23] = Call mutate cond$8_@0(mutate a$2_@0)
172 "]
173 bb3_instrs --> bb3_terminal(["If (read $9_@0)"])
174 end
@@ -189,8 +189,8 @@ flowchart TB
189 end
190 subgraph bb13
191 bb13_instrs["
192 - [13] Const mutate $11_@2 = null
193 - [14] Call mutate mutate$7_@0(mutate d$5_@0, read $11_@2)
192 + [21] Const mutate $11_@2 = null
193 + [22] Call mutate mutate$7_@0(mutate d$5_@0, read $11_@2)
194 "]
195 bb13_instrs --> bb13_terminal(["Return"])
196 end
compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md
+19 -19
@@ -39,7 +39,7 @@ function Component(props) {
39
40 ```
41 bb0:
42 - Return
42 + [1] Return
43 ```
44
45 ### CFG
@@ -70,28 +70,28 @@ bb0:
70 [1] Const mutate a$2_@0 = Object { }
71 [2] Const mutate b$3_@1 = Array [read a$2_@0]
72 [3] Const mutate c$4_@2 = Object { }
73 - [4] Const mutate d$5_@3[0:10] = Object { c: read c$4_@2 }
74 - [5] Const mutate x$6_@3[0:10] = Object { }
75 - [6] Reassign mutate x$6_@3.b[0:10] = read b$3_@1
76 - [7] Const mutate y$7_@3[0:10] = Call mutate mutate$8_@3(mutate x$6_@3, mutate d$5_@3)
77 - If (read a$2_@0) then:bb1 else:bb1
73 + [4] Const mutate d$5_@3[0:15] = Object { c: read c$4_@2 }
74 + [5] Const mutate x$6_@3[0:15] = Object { }
75 + [6] Reassign mutate x$6_@3.b[0:15] = read b$3_@1
76 + [7] Const mutate y$7_@3[0:15] = Call mutate mutate$8_@3(mutate x$6_@3, mutate d$5_@3)
77 + [8] If (read a$2_@0) then:bb1 else:bb1
78 bb1:
79 predecessor blocks: bb0
80 - If (read b$3_@1) then:bb3 else:bb3
80 + [9] If (read b$3_@1) then:bb3 else:bb3
81 bb3:
82 predecessor blocks: bb1
83 - If (read c$4_@2) then:bb5 else:bb5
83 + [10] If (read c$4_@2) then:bb5 else:bb5
84 bb5:
85 predecessor blocks: bb3
86 - If (read d$5_@3) then:bb7 else:bb7
86 + [11] If (read d$5_@3) then:bb7 else:bb7
87 bb7:
88 predecessor blocks: bb5
89 - If (read y$7_@3) then:bb9 else:bb9
89 + [12] If (read y$7_@3) then:bb9 else:bb9
90 bb9:
91 predecessor blocks: bb7
92 - [8] Const mutate $9_@4 = null
93 - [9] Call mutate mutate$8_@3(mutate x$6_@3, read $9_@4)
94 - Return
92 + [13] Const mutate $9_@4 = null
93 + [14] Call mutate mutate$8_@3(mutate x$6_@3, read $9_@4)
94 + [15] Return
95 ```
96
97 ### CFG
@@ -104,10 +104,10 @@ flowchart TB
104 [1] Const mutate a$2_@0 = Object { }
105 [2] Const mutate b$3_@1 = Array [read a$2_@0]
106 [3] Const mutate c$4_@2 = Object { }
107 - [4] Const mutate d$5_@3[0:10] = Object { c: read c$4_@2 }
108 - [5] Const mutate x$6_@3[0:10] = Object { }
109 - [6] Reassign mutate x$6_@3.b[0:10] = read b$3_@1
110 - [7] Const mutate y$7_@3[0:10] = Call mutate mutate$8_@3(mutate x$6_@3, mutate d$5_@3)
107 + [4] Const mutate d$5_@3[0:15] = Object { c: read c$4_@2 }
108 + [5] Const mutate x$6_@3[0:15] = Object { }
109 + [6] Reassign mutate x$6_@3.b[0:15] = read b$3_@1
110 + [7] Const mutate y$7_@3[0:15] = Call mutate mutate$8_@3(mutate x$6_@3, mutate d$5_@3)
111 "]
112 bb0_instrs --> bb0_terminal(["If (read a$2_@0)"])
113 end
@@ -125,8 +125,8 @@ flowchart TB
125 end
126 subgraph bb9
127 bb9_instrs["
128 - [8] Const mutate $9_@4 = null
129 - [9] Call mutate mutate$8_@3(mutate x$6_@3, read $9_@4)
128 + [13] Const mutate $9_@4 = null
129 + [14] Call mutate mutate$8_@3(mutate x$6_@3, read $9_@4)
130 "]
131 bb9_instrs --> bb9_terminal(["Return"])
132 end
compiler/forget/src/__tests__/fixtures/hir/mutable-liverange-loop.expect.md
+27 -27
@@ -38,7 +38,7 @@ function Component(props) {
38
39 ```
40 bb0:
41 - Return
41 + [1] Return
42 ```
43
44 ### CFG
@@ -66,7 +66,7 @@ function mutate$0() {
66
67 ```
68 bb0:
69 - Return
69 + [1] Return
70 ```
71
72 ### CFG
@@ -94,40 +94,40 @@ function cond$0() {
94
95 ```
96 bb0:
97 - [1] Let mutate a$2_@0[0:10] = Object { }
98 - [2] Let mutate b$3_@0[0:10] = Object { }
97 + [1] Let mutate a$2_@0[0:18] = Object { }
98 + [2] Let mutate b$3_@0[0:18] = Object { }
99 [3] Let mutate c$4_@1 = Object { }
100 - [4] Let mutate d$5_@0[0:10] = Object { }
101 - While test=bb1 loop=bb3 fallthrough=bb2
100 + [4] Let mutate d$5_@0[0:18] = Object { }
101 + [5] While test=bb1 loop=bb3 fallthrough=bb2
102 bb1:
103 predecessor blocks: bb0 bb4
104 - [5] Const mutate $9_@2 = true
105 - If (read $9_@2) then:bb3 else:bb2
104 + [6] Const mutate $9_@2 = true
105 + [7] If (read $9_@2) then:bb3 else:bb2
106 bb3:
107 predecessor blocks: bb1
108 - [6] Call mutate mutate$6_@0(mutate a$2_@0, mutate b$3_@0)
109 - [7] Const mutate $8_@0[0:10] = Call mutate cond$7_@0(mutate a$2_@0)
110 - If (read $8_@0) then:bb2 else:bb4
108 + [8] Call mutate mutate$6_@0(mutate a$2_@0, mutate b$3_@0)
109 + [9] Const mutate $8_@0[0:18] = Call mutate cond$7_@0(mutate a$2_@0)
110 + [10] If (read $8_@0) then:bb2 else:bb4
111 bb4:
112 predecessor blocks: bb3
113 - Goto(Continue) bb1
113 + [11] Goto(Continue) bb1
114 bb2:
115 predecessor blocks: bb3 bb1
116 - If (read a$2_@0) then:bb7 else:bb7
116 + [12] If (read a$2_@0) then:bb7 else:bb7
117 bb7:
118 predecessor blocks: bb2
119 - If (read b$3_@0) then:bb9 else:bb9
119 + [13] If (read b$3_@0) then:bb9 else:bb9
120 bb9:
121 predecessor blocks: bb7
122 - If (read c$4_@1) then:bb11 else:bb11
122 + [14] If (read c$4_@1) then:bb11 else:bb11
123 bb11:
124 predecessor blocks: bb9
125 - If (read d$5_@0) then:bb13 else:bb13
125 + [15] If (read d$5_@0) then:bb13 else:bb13
126 bb13:
127 predecessor blocks: bb11
128 - [8] Const mutate $10_@3 = null
129 - [9] Call mutate mutate$6_@0(mutate d$5_@0, read $10_@3)
130 - Return
128 + [16] Const mutate $10_@3 = null
129 + [17] Call mutate mutate$6_@0(mutate d$5_@0, read $10_@3)
130 + [18] Return
131 ```
132
133 ### CFG
@@ -137,23 +137,23 @@ flowchart TB
137 %% Basic Blocks
138 subgraph bb0
139 bb0_instrs["
140 - [1] Let mutate a$2_@0[0:10] = Object { }
141 - [2] Let mutate b$3_@0[0:10] = Object { }
140 + [1] Let mutate a$2_@0[0:18] = Object { }
141 + [2] Let mutate b$3_@0[0:18] = Object { }
142 [3] Let mutate c$4_@1 = Object { }
143 - [4] Let mutate d$5_@0[0:10] = Object { }
143 + [4] Let mutate d$5_@0[0:18] = Object { }
144 "]
145 bb0_instrs --> bb0_terminal(["While"])
146 end
147 subgraph bb1
148 bb1_instrs["
149 - [5] Const mutate $9_@2 = true
149 + [6] Const mutate $9_@2 = true
150 "]
151 bb1_instrs --> bb1_terminal(["If (read $9_@2)"])
152 end
153 subgraph bb3
154 bb3_instrs["
155 - [6] Call mutate mutate$6_@0(mutate a$2_@0, mutate b$3_@0)
156 - [7] Const mutate $8_@0[0:10] = Call mutate cond$7_@0(mutate a$2_@0)
155 + [8] Call mutate mutate$6_@0(mutate a$2_@0, mutate b$3_@0)
156 + [9] Const mutate $8_@0[0:18] = Call mutate cond$7_@0(mutate a$2_@0)
157 "]
158 bb3_instrs --> bb3_terminal(["If (read $8_@0)"])
159 end
@@ -174,8 +174,8 @@ flowchart TB
174 end
175 subgraph bb13
176 bb13_instrs["
177 - [8] Const mutate $10_@3 = null
178 - [9] Call mutate mutate$6_@0(mutate d$5_@0, read $10_@3)
177 + [16] Const mutate $10_@3 = null
178 + [17] Call mutate mutate$6_@0(mutate d$5_@0, read $10_@3)
179 "]
180 bb13_instrs --> bb13_terminal(["Return"])
181 end
compiler/forget/src/__tests__/fixtures/hir/property-assignment.expect.md
+1 -1
@@ -23,7 +23,7 @@ bb0:
23 [4] Const mutate child$4_@2 = JSX <read Component$0 data={freeze y$3_@1} ></read Component$0>
24 [5] Call mutate x$2_@0.y.push(read props$1.p0)
25 [6] Const mutate $5_@3 = JSX <read Component$0 data={freeze x$2_@0} >{read child$4_@2}</read Component$0>
26 - Return read $5_@3
26 + [7] Return read $5_@3
27 ```
28
29 ### CFG
compiler/forget/src/__tests__/fixtures/hir/reactive-scope-grouping.expect.md
+1 -1
@@ -23,7 +23,7 @@ bb0:
23 [3] Let mutate z$3_@1[2:5] = Object { }
24 [4] Call mutate y$2_@1.push(mutate z$3_@1)
25 [5] Reassign mutate x$1_@0.y[1:6] = read y$2_@1
26 - Return freeze x$1_@0
26 + [6] Return freeze x$1_@0
27 ```
28
29 ### CFG
compiler/forget/src/__tests__/fixtures/hir/reactive-scopes.expect.md
+12 -12
@@ -19,22 +19,22 @@ function f(a, b) {
19
20 ```
21 bb0:
22 - [1] Let mutate x$3_@0[1:5] = Array []
22 + [1] Let mutate x$3_@0[1:7] = Array []
23 [2] Const mutate $4_@1 = 1
24 [3] Const mutate $5_@2 = Binary read a$1.length === read $4_@1
25 - If (read $5_@2) then:bb2 else:bb1
25 + [4] If (read $5_@2) then:bb2 else:bb1
26 bb2:
27 predecessor blocks: bb0
28 - If (read b$2) then:bb4 else:bb1
28 + [5] If (read b$2) then:bb4 else:bb1
29 bb4:
30 predecessor blocks: bb2
31 - [4] Call mutate x$3_@0.push(read b$2)
32 - Goto bb1
31 + [6] Call mutate x$3_@0.push(read b$2)
32 + [7] Goto bb1
33 bb1:
34 predecessor blocks: bb4 bb2 bb0
35 - [5] Const mutate $6_@3 = "div"
36 - [6] Const mutate $7_@4 = JSX <read $6_@3>{freeze x$3_@0}</read $6_@3>
37 - Return read $7_@4
35 + [8] Const mutate $6_@3 = "div"
36 + [9] Const mutate $7_@4 = JSX <read $6_@3>{freeze x$3_@0}</read $6_@3>
37 + [10] Return read $7_@4
38 ```
39
40 ### CFG
@@ -44,7 +44,7 @@ flowchart TB
44 %% Basic Blocks
45 subgraph bb0
46 bb0_instrs["
47 - [1] Let mutate x$3_@0[1:5] = Array []
47 + [1] Let mutate x$3_@0[1:7] = Array []
48 [2] Const mutate $4_@1 = 1
49 [3] Const mutate $5_@2 = Binary read a$1.length === read $4_@1
50 "]
@@ -55,14 +55,14 @@ flowchart TB
55 end
56 subgraph bb4
57 bb4_instrs["
58 - [4] Call mutate x$3_@0.push(read b$2)
58 + [6] Call mutate x$3_@0.push(read b$2)
59 "]
60 bb4_instrs --> bb4_terminal(["Goto"])
61 end
62 subgraph bb1
63 bb1_instrs["
64 - [5] Const mutate $6_@3 = 'div'
65 - [6] Const mutate $7_@4 = JSX <read $6_@3>{freeze x$3_@0}</read $6_@3>
64 + [8] Const mutate $6_@3 = 'div'
65 + [9] Const mutate $7_@4 = JSX <read $6_@3>{freeze x$3_@0}</read $6_@3>
66 "]
67 bb1_instrs --> bb1_terminal(["Return read $7_@4"])
68 end
compiler/forget/src/__tests__/fixtures/hir/reassignment-conditional.expect.md
+15 -15
@@ -23,20 +23,20 @@ function Component(props) {
23
24 ```
25 bb0:
26 - [1] Let mutate x$2_@0[1:5] = Array []
26 + [1] Let mutate x$2_@0[1:6] = Array []
27 [2] Call mutate x$2_@0.push(read props$1.p0)
28 - [3] Let mutate y$3_@0[1:5] = read x$2_@0
29 - If (read props$1.p1) then:bb2 else:bb1
28 + [3] Let mutate y$3_@0[1:6] = read x$2_@0
29 + [4] If (read props$1.p1) then:bb2 else:bb1
30 bb2:
31 predecessor blocks: bb0
32 - [4] Reassign mutate x$2_@0[1:5] = Array []
33 - Goto bb1
32 + [5] Reassign mutate x$2_@0[1:6] = Array []
33 + [6] Goto bb1
34 bb1:
35 predecessor blocks: bb2 bb0
36 - [5] Let mutate _$4_@1 = JSX <read Component$0 x={freeze x$2_@0} ></read Component$0>
37 - [6] Call read y$3_@0.push(read props$1.p2)
38 - [7] Const mutate $5_@2 = JSX <read Component$0 x={read x$2_@0} y={read y$3_@0} ></read Component$0>
39 - Return read $5_@2
36 + [7] Let mutate _$4_@1 = JSX <read Component$0 x={freeze x$2_@0} ></read Component$0>
37 + [8] Call read y$3_@0.push(read props$1.p2)
38 + [9] Const mutate $5_@2 = JSX <read Component$0 x={read x$2_@0} y={read y$3_@0} ></read Component$0>
39 + [10] Return read $5_@2
40 ```
41
42 ### CFG
@@ -46,23 +46,23 @@ flowchart TB
46 %% Basic Blocks
47 subgraph bb0
48 bb0_instrs["
49 - [1] Let mutate x$2_@0[1:5] = Array []
49 + [1] Let mutate x$2_@0[1:6] = Array []
50 [2] Call mutate x$2_@0.push(read props$1.p0)
51 - [3] Let mutate y$3_@0[1:5] = read x$2_@0
51 + [3] Let mutate y$3_@0[1:6] = read x$2_@0
52 "]
53 bb0_instrs --> bb0_terminal(["If (read props$1.p1)"])
54 end
55 subgraph bb2
56 bb2_instrs["
57 - [4] Reassign mutate x$2_@0[1:5] = Array []
57 + [5] Reassign mutate x$2_@0[1:6] = Array []
58 "]
59 bb2_instrs --> bb2_terminal(["Goto"])
60 end
61 subgraph bb1
62 bb1_instrs["
63 - [5] Let mutate _$4_@1 = JSX <read Component$0 x={freeze x$2_@0} ></read Component$0>
64 - [6] Call read y$3_@0.push(read props$1.p2)
65 - [7] Const mutate $5_@2 = JSX <read Component$0 x={read x$2_@0} y={read y$3_@0} ></read Component$0>
63 + [7] Let mutate _$4_@1 = JSX <read Component$0 x={freeze x$2_@0} ></read Component$0>
64 + [8] Call read y$3_@0.push(read props$1.p2)
65 + [9] Const mutate $5_@2 = JSX <read Component$0 x={read x$2_@0} y={read y$3_@0} ></read Component$0>
66 "]
67 bb1_instrs --> bb1_terminal(["Return read $5_@2"])
68 end
compiler/forget/src/__tests__/fixtures/hir/reassignment.expect.md
+1 -1
@@ -28,7 +28,7 @@ bb0:
28 [5] Let mutate _$4_@2 = JSX <read Component$0 x={freeze x$2_@1} ></read Component$0>
29 [6] Call mutate y$3_@0.push(read props$1.p1)
30 [7] Const mutate $5_@3 = JSX <read Component$0 x={read x$2_@1} y={freeze y$3_@0} ></read Component$0>
31 - Return read $5_@3
31 + [8] Return read $5_@3
32 ```
33
34 ### CFG
compiler/forget/src/__tests__/fixtures/hir/reverse-postorder.expect.md
+27 -27
@@ -37,44 +37,44 @@ function Component(props) {
37 ```
38 bb0:
39 [1] Let mutate x$2_@0 = undefined
40 - If (read props$1.cond) then:bb2 else:bb10
40 + [2] If (read props$1.cond) then:bb2 else:bb10
41 bb2:
42 predecessor blocks: bb0
43 - [2] Const mutate $3_@1 = 2
44 - [3] Const mutate $4_@2 = 1
45 - [4] Const mutate $5_@3 = 0
46 - Switch (read props$1.test)
43 + [3] Const mutate $3_@1 = 2
44 + [4] Const mutate $4_@2 = 1
45 + [5] Const mutate $5_@3 = 0
46 + [6] Switch (read props$1.test)
47 Case read $5_@3: bb8
48 Case read $4_@2: bb6
49 Case read $3_@1: bb4
50 Default: bb4
51 bb8:
52 predecessor blocks: bb2
53 - [5] Reassign mutate x$2_@4[5:10] = read props$1.v0
54 - Goto bb1
53 + [7] Reassign mutate x$2_@4[7:17] = read props$1.v0
54 + [8] Goto bb1
55 bb6:
56 predecessor blocks: bb2
57 - [6] Reassign mutate x$2_@4[5:10] = read props$1.v1
58 - Goto bb1
57 + [9] Reassign mutate x$2_@4[7:17] = read props$1.v1
58 + [10] Goto bb1
59 bb4:
60 predecessor blocks: bb2
61 - [7] Reassign mutate x$2_@4[5:10] = read props$1.v2
62 - Goto bb1
61 + [11] Reassign mutate x$2_@4[7:17] = read props$1.v2
62 + [12] Goto bb1
63 bb10:
64 predecessor blocks: bb0
65 - If (read props$1.cond2) then:bb12 else:bb13
65 + [13] If (read props$1.cond2) then:bb12 else:bb13
66 bb12:
67 predecessor blocks: bb10
68 - [8] Reassign mutate x$2_@4[5:10] = read props$1.b
69 - Goto bb1
68 + [14] Reassign mutate x$2_@4[7:17] = read props$1.b
69 + [15] Goto bb1
70 bb13:
71 predecessor blocks: bb10
72 - [9] Reassign mutate x$2_@4[5:10] = read props$1.c
73 - Goto bb1
72 + [16] Reassign mutate x$2_@4[7:17] = read props$1.c
73 + [17] Goto bb1
74 bb1:
75 predecessor blocks: bb8 bb6 bb4 bb12 bb13
76 - [10] read x$2_@4
77 - Return
76 + [18] read x$2_@4
77 + [19] Return
78 ```
79
80 ### CFG
@@ -90,27 +90,27 @@ flowchart TB
90 end
91 subgraph bb2
92 bb2_instrs["
93 - [2] Const mutate $3_@1 = 2
94 - [3] Const mutate $4_@2 = 1
95 - [4] Const mutate $5_@3 = 0
93 + [3] Const mutate $3_@1 = 2
94 + [4] Const mutate $4_@2 = 1
95 + [5] Const mutate $5_@3 = 0
96 "]
97 bb2_instrs --> bb2_terminal(["Switch (read props$1.test)"])
98 end
99 subgraph bb8
100 bb8_instrs["
101 - [5] Reassign mutate x$2_@4[5:10] = read props$1.v0
101 + [7] Reassign mutate x$2_@4[7:17] = read props$1.v0
102 "]
103 bb8_instrs --> bb8_terminal(["Goto"])
104 end
105 subgraph bb6
106 bb6_instrs["
107 - [6] Reassign mutate x$2_@4[5:10] = read props$1.v1
107 + [9] Reassign mutate x$2_@4[7:17] = read props$1.v1
108 "]
109 bb6_instrs --> bb6_terminal(["Goto"])
110 end
111 subgraph bb4
112 bb4_instrs["
113 - [7] Reassign mutate x$2_@4[5:10] = read props$1.v2
113 + [11] Reassign mutate x$2_@4[7:17] = read props$1.v2
114 "]
115 bb4_instrs --> bb4_terminal(["Goto"])
116 end
@@ -119,19 +119,19 @@ flowchart TB
119 end
120 subgraph bb12
121 bb12_instrs["
122 - [8] Reassign mutate x$2_@4[5:10] = read props$1.b
122 + [14] Reassign mutate x$2_@4[7:17] = read props$1.b
123 "]
124 bb12_instrs --> bb12_terminal(["Goto"])
125 end
126 subgraph bb13
127 bb13_instrs["
128 - [9] Reassign mutate x$2_@4[5:10] = read props$1.c
128 + [16] Reassign mutate x$2_@4[7:17] = read props$1.c
129 "]
130 bb13_instrs --> bb13_terminal(["Goto"])
131 end
132 subgraph bb1
133 bb1_instrs["
134 - [10] read x$2_@4
134 + [18] read x$2_@4
135 "]
136 bb1_instrs --> bb1_terminal(["Return"])
137 end
compiler/forget/src/__tests__/fixtures/hir/simple-alias.expect.md
+2 -2
@@ -20,7 +20,7 @@ function foo() {
20
21 ```
22 bb0:
23 - Return
23 + [1] Return
24 ```
25
26 ### CFG
@@ -55,7 +55,7 @@ bb0:
55 [5] Reassign mutate b$2_@1[0:8] = read c$3_@1
56 [6] Reassign mutate c$3_@1[0:8] = read a$1_@1
57 [7] Call mutate mutate$4_@1(mutate a$1_@1, mutate b$2_@1)
58 - Return freeze c$3_@1
58 + [8] Return freeze c$3_@1
59 ```
60
61 ### CFG
compiler/forget/src/__tests__/fixtures/hir/simple.expect.md
+13 -13
@@ -15,18 +15,18 @@ function foo(x, y) {
15
16 ```
17 bb0:
18 - If (read x$1) then:bb2 else:bb1
18 + [1] If (read x$1) then:bb2 else:bb1
19 bb2:
20 predecessor blocks: bb0
21 - [1] Const mutate $3_@0 = false
22 - [2] Const mutate $4_@1 = Call read foo$0(read $3_@0, read y$2)
23 - Return freeze $4_@1
21 + [2] Const mutate $3_@0 = false
22 + [3] Const mutate $4_@1 = Call read foo$0(read $3_@0, read y$2)
23 + [4] Return freeze $4_@1
24 bb1:
25 predecessor blocks: bb0
26 - [3] Const mutate $5_@2 = 10
27 - [4] Const mutate $6_@3 = Binary read y$2 * read $5_@2
28 - [5] Const mutate $7_@4 = Array [read $6_@3]
29 - Return freeze $7_@4
26 + [5] Const mutate $5_@2 = 10
27 + [6] Const mutate $6_@3 = Binary read y$2 * read $5_@2
28 + [7] Const mutate $7_@4 = Array [read $6_@3]
29 + [8] Return freeze $7_@4
30 ```
31
32 ### CFG
@@ -39,16 +39,16 @@ flowchart TB
39 end
40 subgraph bb2
41 bb2_instrs["
42 - [1] Const mutate $3_@0 = false
43 - [2] Const mutate $4_@1 = Call read foo$0(read $3_@0, read y$2)
42 + [2] Const mutate $3_@0 = false
43 + [3] Const mutate $4_@1 = Call read foo$0(read $3_@0, read y$2)
44 "]
45 bb2_instrs --> bb2_terminal(["Return freeze $4_@1"])
46 end
47 subgraph bb1
48 bb1_instrs["
49 - [3] Const mutate $5_@2 = 10
50 - [4] Const mutate $6_@3 = Binary read y$2 * read $5_@2
51 - [5] Const mutate $7_@4 = Array [read $6_@3]
49 + [5] Const mutate $5_@2 = 10
50 + [6] Const mutate $6_@3 = Binary read y$2 * read $5_@2
51 + [7] Const mutate $7_@4 = Array [read $6_@3]
52 "]
53 bb1_instrs --> bb1_terminal(["Return freeze $7_@4"])
54 end
compiler/forget/src/__tests__/fixtures/hir/ssa-arrayexpression.expect.md
+1 -1
@@ -18,7 +18,7 @@ bb0:
18 [1] Const mutate a$2_@0 = 1
19 [2] Const mutate b$3_@1 = 2
20 [3] Const mutate x$4_@2 = Array [read a$2_@0, read b$3_@1]
21 - Return freeze x$4_@2
21 + [4] Return freeze x$4_@2
22 ```
23
24 ### CFG
compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx-2.expect.md
+20 -20
@@ -22,7 +22,7 @@ function Component(props) {
22
23 ```
24 bb0:
25 - Return
25 + [1] Return
26 ```
27
28 ### CFG
@@ -50,22 +50,22 @@ function foo$0() {
50
51 ```
52 bb0:
53 - [1] Const mutate a$2_@0[0:8] = Array []
54 - [2] Const mutate b$3_@0[0:8] = Object { }
53 + [1] Const mutate a$2_@0[0:10] = Array []
54 + [2] Const mutate b$3_@0[0:10] = Object { }
55 [3] Call mutate foo$4_@0(mutate a$2_@0, mutate b$3_@0)
56 - [4] Const mutate $7_@0[0:8] = Call mutate foo$4_@0()
57 - If (read $7_@0) then:bb2 else:bb1
56 + [4] Const mutate $7_@0[0:10] = Call mutate foo$4_@0()
57 + [5] If (read $7_@0) then:bb2 else:bb1
58 bb2:
59 predecessor blocks: bb0
60 - [5] Const mutate $6_@1 = "div"
61 - [6] Let mutate _$5_@2 = JSX <read $6_@1 a={freeze a$2_@0} ></read $6_@1>
62 - Goto bb1
60 + [6] Const mutate $6_@1 = "div"
61 + [7] Let mutate _$5_@2 = JSX <read $6_@1 a={freeze a$2_@0} ></read $6_@1>
62 + [8] Goto bb1
63 bb1:
64 predecessor blocks: bb2 bb0
65 - [7] Call mutate foo$4_@0(read a$2_@0, mutate b$3_@0)
66 - [8] Const mutate $8_@3 = "div"
67 - [9] Const mutate $9_@4 = JSX <read $8_@3 a={freeze a$2_@0} b={freeze b$3_@0} ></read $8_@3>
68 - Return read $9_@4
65 + [9] Call mutate foo$4_@0(read a$2_@0, mutate b$3_@0)
66 + [10] Const mutate $8_@3 = "div"
67 + [11] Const mutate $9_@4 = JSX <read $8_@3 a={freeze a$2_@0} b={freeze b$3_@0} ></read $8_@3>
68 + [12] Return read $9_@4
69 ```
70
71 ### CFG
@@ -75,25 +75,25 @@ flowchart TB
75 %% Basic Blocks
76 subgraph bb0
77 bb0_instrs["
78 - [1] Const mutate a$2_@0[0:8] = Array []
79 - [2] Const mutate b$3_@0[0:8] = Object { }
78 + [1] Const mutate a$2_@0[0:10] = Array []
79 + [2] Const mutate b$3_@0[0:10] = Object { }
80 [3] Call mutate foo$4_@0(mutate a$2_@0, mutate b$3_@0)
81 - [4] Const mutate $7_@0[0:8] = Call mutate foo$4_@0()
81 + [4] Const mutate $7_@0[0:10] = Call mutate foo$4_@0()
82 "]
83 bb0_instrs --> bb0_terminal(["If (read $7_@0)"])
84 end
85 subgraph bb2
86 bb2_instrs["
87 - [5] Const mutate $6_@1 = 'div'
88 - [6] Let mutate _$5_@2 = JSX <read $6_@1 a={freeze a$2_@0} ></read $6_@1>
87 + [6] Const mutate $6_@1 = 'div'
88 + [7] Let mutate _$5_@2 = JSX <read $6_@1 a={freeze a$2_@0} ></read $6_@1>
89 "]
90 bb2_instrs --> bb2_terminal(["Goto"])
91 end
92 subgraph bb1
93 bb1_instrs["
94 - [7] Call mutate foo$4_@0(read a$2_@0, mutate b$3_@0)
95 - [8] Const mutate $8_@3 = 'div'
96 - [9] Const mutate $9_@4 = JSX <read $8_@3 a={freeze a$2_@0} b={freeze b$3_@0} ></read $8_@3>
94 + [9] Call mutate foo$4_@0(read a$2_@0, mutate b$3_@0)
95 + [10] Const mutate $8_@3 = 'div'
96 + [11] Const mutate $9_@4 = JSX <read $8_@3 a={freeze a$2_@0} b={freeze b$3_@0} ></read $8_@3>
97 "]
98 bb1_instrs --> bb1_terminal(["Return read $9_@4"])
99 end
compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx.expect.md
+2 -2
@@ -19,7 +19,7 @@ function Component(props) {
19
20 ```
21 bb0:
22 - Return
22 + [1] Return
23 ```
24
25 ### CFG
@@ -55,7 +55,7 @@ bb0:
55 [6] Call mutate foo$4_@0(read a$2_@0, mutate b$3_@0)
56 [7] Const mutate $7_@3 = "div"
57 [8] Const mutate $8_@4 = JSX <read $7_@3 a={read a$2_@0} b={freeze b$3_@0} ></read $7_@3>
58 - Return read $8_@4
58 + [9] Return read $8_@4
59 ```
60
61 ### CFG
compiler/forget/src/__tests__/fixtures/hir/ssa-complex-multiple-if.expect.md
+17 -17
@@ -21,28 +21,28 @@ function foo() {
21
22 ```
23 bb0:
24 - [1] Let mutate x$1_@0[1:10] = 1
24 + [1] Let mutate x$1_@0[1:14] = 1
25 [2] Let mutate y$2_@1 = 2
26 [3] Const mutate $3_@2 = 2
27 [4] Const mutate $4_@3 = Binary read y$2_@1 === read $3_@2
28 - If (read $4_@3) then:bb2 else:bb1
28 + [5] If (read $4_@3) then:bb2 else:bb1
29 bb2:
30 predecessor blocks: bb0
31 - [5] Reassign mutate x$1_@0[1:10] = 3
32 - Goto bb1
31 + [6] Reassign mutate x$1_@0[1:14] = 3
32 + [7] Goto bb1
33 bb1:
34 predecessor blocks: bb2 bb0
35 - [6] Const mutate $5_@4 = 3
36 - [7] Const mutate $6_@5 = Binary read y$2_@1 === read $5_@4
37 - If (read $6_@5) then:bb4 else:bb3
35 + [8] Const mutate $5_@4 = 3
36 + [9] Const mutate $6_@5 = Binary read y$2_@1 === read $5_@4
37 + [10] If (read $6_@5) then:bb4 else:bb3
38 bb4:
39 predecessor blocks: bb1
40 - [8] Reassign mutate x$1_@0[1:10] = 5
41 - Goto bb3
40 + [11] Reassign mutate x$1_@0[1:14] = 5
41 + [12] Goto bb3
42 bb3:
43 predecessor blocks: bb4 bb1
44 - [9] Reassign mutate y$2_@0[1:10] = read x$1_@0
45 - Return
44 + [13] Reassign mutate y$2_@0[1:14] = read x$1_@0
45 + [14] Return
46 ```
47
48 ### CFG
@@ -52,7 +52,7 @@ flowchart TB
52 %% Basic Blocks
53 subgraph bb0
54 bb0_instrs["
55 - [1] Let mutate x$1_@0[1:10] = 1
55 + [1] Let mutate x$1_@0[1:14] = 1
56 [2] Let mutate y$2_@1 = 2
57 [3] Const mutate $3_@2 = 2
58 [4] Const mutate $4_@3 = Binary read y$2_@1 === read $3_@2
@@ -61,26 +61,26 @@ flowchart TB
61 end
62 subgraph bb2
63 bb2_instrs["
64 - [5] Reassign mutate x$1_@0[1:10] = 3
64 + [6] Reassign mutate x$1_@0[1:14] = 3
65 "]
66 bb2_instrs --> bb2_terminal(["Goto"])
67 end
68 subgraph bb1
69 bb1_instrs["
70 - [6] Const mutate $5_@4 = 3
71 - [7] Const mutate $6_@5 = Binary read y$2_@1 === read $5_@4
70 + [8] Const mutate $5_@4 = 3
71 + [9] Const mutate $6_@5 = Binary read y$2_@1 === read $5_@4
72 "]
73 bb1_instrs --> bb1_terminal(["If (read $6_@5)"])
74 end
75 subgraph bb4
76 bb4_instrs["
77 - [8] Reassign mutate x$1_@0[1:10] = 5
77 + [11] Reassign mutate x$1_@0[1:14] = 5
78 "]
79 bb4_instrs --> bb4_terminal(["Goto"])
80 end
81 subgraph bb3
82 bb3_instrs["
83 - [9] Reassign mutate y$2_@0[1:10] = read x$1_@0
83 + [13] Reassign mutate y$2_@0[1:14] = read x$1_@0
84 "]
85 bb3_instrs --> bb3_terminal(["Return"])
86 end
compiler/forget/src/__tests__/fixtures/hir/ssa-complex-single-if.expect.md
+9 -9
@@ -18,19 +18,19 @@ function foo() {
18
19 ```
20 bb0:
21 - [1] Let mutate x$1_@0[1:7] = 1
21 + [1] Let mutate x$1_@0[1:9] = 1
22 [2] Let mutate y$2_@1 = 2
23 [3] Const mutate $3_@2 = 2
24 [4] Const mutate $4_@3 = Binary read y$2_@1 === read $3_@2
25 - If (read $4_@3) then:bb2 else:bb1
25 + [5] If (read $4_@3) then:bb2 else:bb1
26 bb2:
27 predecessor blocks: bb0
28 - [5] Reassign mutate x$1_@0[1:7] = 3
29 - Goto bb1
28 + [6] Reassign mutate x$1_@0[1:9] = 3
29 + [7] Goto bb1
30 bb1:
31 predecessor blocks: bb2 bb0
32 - [6] Reassign mutate y$2_@0[1:7] = read x$1_@0
33 - Return
32 + [8] Reassign mutate y$2_@0[1:9] = read x$1_@0
33 + [9] Return
34 ```
35
36 ### CFG
@@ -40,7 +40,7 @@ flowchart TB
40 %% Basic Blocks
41 subgraph bb0
42 bb0_instrs["
43 - [1] Let mutate x$1_@0[1:7] = 1
43 + [1] Let mutate x$1_@0[1:9] = 1
44 [2] Let mutate y$2_@1 = 2
45 [3] Const mutate $3_@2 = 2
46 [4] Const mutate $4_@3 = Binary read y$2_@1 === read $3_@2
@@ -49,13 +49,13 @@ flowchart TB
49 end
50 subgraph bb2
51 bb2_instrs["
52 - [5] Reassign mutate x$1_@0[1:7] = 3
52 + [6] Reassign mutate x$1_@0[1:9] = 3
53 "]
54 bb2_instrs --> bb2_terminal(["Goto"])
55 end
56 subgraph bb1
57 bb1_instrs["
58 - [6] Reassign mutate y$2_@0[1:7] = read x$1_@0
58 + [8] Reassign mutate y$2_@0[1:9] = read x$1_@0
59 "]
60 bb1_instrs --> bb1_terminal(["Return"])
61 end
compiler/forget/src/__tests__/fixtures/hir/ssa-for-of.expect.md
+10 -10
@@ -20,24 +20,24 @@ function foo(cond) {
20 ```
21 bb0:
22 [1] Let mutate items$2_@0 = Array []
23 - Goto bb1
23 + [2] Goto bb1
24 bb1:
25 predecessor blocks: bb0 bb4
26 - If (read items$2_@0) then:bb3 else:bb2
26 + [3] If (read items$2_@0) then:bb3 else:bb2
27 bb3:
28 predecessor blocks: bb1
29 - [2] Let mutate y$3_@1 = 0
30 - If (read cond$1) then:bb5 else:bb4
29 + [4] Let mutate y$3_@1 = 0
30 + [5] If (read cond$1) then:bb5 else:bb4
31 bb5:
32 predecessor blocks: bb3
33 - [3] Reassign mutate y$3_@2 = 1
34 - Goto bb4
33 + [6] Reassign mutate y$3_@2 = 1
34 + [7] Goto bb4
35 bb4:
36 predecessor blocks: bb5 bb3
37 - Goto(Continue) bb1
37 + [8] Goto(Continue) bb1
38 bb2:
39 predecessor blocks: bb1
40 - Return freeze items$2_@0
40 + [9] Return freeze items$2_@0
41 ```
42
43 ### CFG
@@ -56,13 +56,13 @@ flowchart TB
56 end
57 subgraph bb3
58 bb3_instrs["
59 - [2] Let mutate y$3_@1 = 0
59 + [4] Let mutate y$3_@1 = 0
60 "]
61 bb3_instrs --> bb3_terminal(["If (read cond$1)"])
62 end
63 subgraph bb5
64 bb5_instrs["
65 - [3] Reassign mutate y$3_@2 = 1
65 + [6] Reassign mutate y$3_@2 = 1
66 "]
67 bb5_instrs --> bb5_terminal(["Goto"])
68 end
compiler/forget/src/__tests__/fixtures/hir/ssa-for.expect.md
+14 -14
@@ -16,21 +16,21 @@ function foo() {
16
17 ```
18 bb0:
19 - [1] Let mutate x$1_@0[0:6] = 0
20 - Goto bb1
19 + [1] Let mutate x$1_@0[0:8] = 0
20 + [2] Goto bb1
21 bb1:
22 predecessor blocks: bb0 bb4
23 - [2] Const mutate $3_@1 = 10
24 - [3] Const mutate $4_@2 = Binary read x$1_@0 < read $3_@1
25 - If (read $4_@2) then:bb4 else:bb2
23 + [3] Const mutate $3_@1 = 10
24 + [4] Const mutate $4_@2 = Binary read x$1_@0 < read $3_@1
25 + [5] If (read $4_@2) then:bb4 else:bb2
26 bb4:
27 predecessor blocks: bb1
28 - [4] Const mutate $2_@3 = 1
29 - [5] Reassign mutate x$1_@0[0:6] = Binary read x$1_@0 + read $2_@3
30 - Goto(Continue) bb1
28 + [6] Const mutate $2_@3 = 1
29 + [7] Reassign mutate x$1_@0[0:8] = Binary read x$1_@0 + read $2_@3
30 + [8] Goto(Continue) bb1
31 bb2:
32 predecessor blocks: bb1
33 - Return read x$1_@0
33 + [9] Return read x$1_@0
34 ```
35
36 ### CFG
@@ -40,21 +40,21 @@ flowchart TB
40 %% Basic Blocks
41 subgraph bb0
42 bb0_instrs["
43 - [1] Let mutate x$1_@0[0:6] = 0
43 + [1] Let mutate x$1_@0[0:8] = 0
44 "]
45 bb0_instrs --> bb0_terminal(["Goto"])
46 end
47 subgraph bb1
48 bb1_instrs["
49 - [2] Const mutate $3_@1 = 10
50 - [3] Const mutate $4_@2 = Binary read x$1_@0 < read $3_@1
49 + [3] Const mutate $3_@1 = 10
50 + [4] Const mutate $4_@2 = Binary read x$1_@0 < read $3_@1
51 "]
52 bb1_instrs --> bb1_terminal(["If (read $4_@2)"])
53 end
54 subgraph bb4
55 bb4_instrs["
56 - [4] Const mutate $2_@3 = 1
57 - [5] Reassign mutate x$1_@0[0:6] = Binary read x$1_@0 + read $2_@3
56 + [6] Const mutate $2_@3 = 1
57 + [7] Reassign mutate x$1_@0[0:8] = Binary read x$1_@0 + read $2_@3
58 "]
59 bb4_instrs --> bb4_terminal(["Goto"])
60 end
compiler/forget/src/__tests__/fixtures/hir/ssa-if-else.expect.md
+10 -10
@@ -19,20 +19,20 @@ function foo() {
19
20 ```
21 bb0:
22 - [1] Let mutate x$1_@0[1:5] = 1
22 + [1] Let mutate x$1_@0[1:7] = 1
23 [2] Let mutate y$2_@1 = 2
24 - If (read y$2_@1) then:bb2 else:bb3
24 + [3] If (read y$2_@1) then:bb2 else:bb3
25 bb2:
26 predecessor blocks: bb0
27 - [3] Let mutate z$3_@0[1:5] = Binary read x$1_@0 + read y$2_@1
28 - Goto bb1
27 + [4] Let mutate z$3_@0[1:7] = Binary read x$1_@0 + read y$2_@1
28 + [5] Goto bb1
29 bb3:
30 predecessor blocks: bb0
31 - [4] Let mutate z$4_@0[1:5] = read x$1_@0
32 - Goto bb1
31 + [6] Let mutate z$4_@0[1:7] = read x$1_@0
32 + [7] Goto bb1
33 bb1:
34 predecessor blocks: bb2 bb3
35 - Return
35 + [8] Return
36 ```
37
38 ### CFG
@@ -42,20 +42,20 @@ flowchart TB
42 %% Basic Blocks
43 subgraph bb0
44 bb0_instrs["
45 - [1] Let mutate x$1_@0[1:5] = 1
45 + [1] Let mutate x$1_@0[1:7] = 1
46 [2] Let mutate y$2_@1 = 2
47 "]
48 bb0_instrs --> bb0_terminal(["If (read y$2_@1)"])
49 end
50 subgraph bb2
51 bb2_instrs["
52 - [3] Let mutate z$3_@0[1:5] = Binary read x$1_@0 + read y$2_@1
52 + [4] Let mutate z$3_@0[1:7] = Binary read x$1_@0 + read y$2_@1
53 "]
54 bb2_instrs --> bb2_terminal(["Goto"])
55 end
56 subgraph bb3
57 bb3_instrs["
58 - [4] Let mutate z$4_@0[1:5] = read x$1_@0
58 + [6] Let mutate z$4_@0[1:7] = read x$1_@0
59 "]
60 bb3_instrs --> bb3_terminal(["Goto"])
61 end
compiler/forget/src/__tests__/fixtures/hir/ssa-nested-loops-no-reassign.expect.md
+14 -14
@@ -22,36 +22,36 @@ function foo(a, b, c) {
22 ```
23 bb0:
24 [1] Let mutate x$4_@0 = 0
25 - While test=bb1 loop=bb3 fallthrough=bb2
25 + [2] While test=bb1 loop=bb3 fallthrough=bb2
26 bb1:
27 predecessor blocks: bb0 bb5
28 - If (read a$1) then:bb3 else:bb2
28 + [3] If (read a$1) then:bb3 else:bb2
29 bb3:
30 predecessor blocks: bb1
31 - While test=bb4 loop=bb6 fallthrough=bb5
31 + [4] While test=bb4 loop=bb6 fallthrough=bb5
32 bb4:
33 predecessor blocks: bb3 bb8
34 - If (read b$2) then:bb6 else:bb5
34 + [5] If (read b$2) then:bb6 else:bb5
35 bb6:
36 predecessor blocks: bb4
37 - While test=bb7 loop=bb9 fallthrough=bb8
37 + [6] While test=bb7 loop=bb9 fallthrough=bb8
38 bb7:
39 predecessor blocks: bb6 bb9
40 - If (read c$3) then:bb9 else:bb8
40 + [7] If (read c$3) then:bb9 else:bb8
41 bb9:
42 predecessor blocks: bb7
43 - [2] Const mutate $5_@1 = 1
44 - [3] Binary read x$4_@0 + read $5_@1
45 - Goto(Continue) bb7
43 + [8] Const mutate $5_@1 = 1
44 + [9] Binary read x$4_@0 + read $5_@1
45 + [10] Goto(Continue) bb7
46 bb8:
47 predecessor blocks: bb7
48 - Goto(Continue) bb4
48 + [11] Goto(Continue) bb4
49 bb5:
50 predecessor blocks: bb4
51 - Goto(Continue) bb1
51 + [12] Goto(Continue) bb1
52 bb2:
53 predecessor blocks: bb1
54 - Return read x$4_@0
54 + [13] Return read x$4_@0
55 ```
56
57 ### CFG
@@ -82,8 +82,8 @@ flowchart TB
82 end
83 subgraph bb9
84 bb9_instrs["
85 - [2] Const mutate $5_@1 = 1
86 - [3] Binary read x$4_@0 + read $5_@1
85 + [8] Const mutate $5_@1 = 1
86 + [9] Binary read x$4_@0 + read $5_@1
87 "]
88 bb9_instrs --> bb9_terminal(["Goto"])
89 end
compiler/forget/src/__tests__/fixtures/hir/ssa-newexpression.expect.md
+2 -2
@@ -17,7 +17,7 @@ function Component(props) {
17
18 ```
19 bb0:
20 - Return
20 + [1] Return
21 ```
22
23 ### CFG
@@ -48,7 +48,7 @@ bb0:
48 [1] Const mutate a$2_@0[0:4] = Array []
49 [2] Const mutate b$3_@0[0:4] = Object { }
50 [3] Let mutate c$4_@0[0:4] = New mutate Foo$5_@0(mutate a$2_@0, mutate b$3_@0)
51 - Return freeze c$4_@0
51 + [4] Return freeze c$4_@0
52 ```
53
54 ### CFG
compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression-phi.expect.md
+14 -14
@@ -22,23 +22,23 @@ function foo() {
22
23 ```
24 bb0:
25 - [1] Let mutate x$1_@0[1:6] = 1
26 - [2] Let mutate y$2_@1[2:7] = 2
25 + [1] Let mutate x$1_@0[1:7] = 1
26 + [2] Let mutate y$2_@1[2:9] = 2
27 [3] Const mutate $3_@2 = 1
28 [4] Const mutate $4_@3 = Binary read x$1_@0 > read $3_@2
29 - If (read $4_@3) then:bb2 else:bb3
29 + [5] If (read $4_@3) then:bb2 else:bb3
30 bb2:
31 predecessor blocks: bb0
32 - [5] Reassign mutate x$1_@0[1:6] = 2
33 - Goto bb1
32 + [6] Reassign mutate x$1_@0[1:7] = 2
33 + [7] Goto bb1
34 bb3:
35 predecessor blocks: bb0
36 - [6] Reassign mutate y$2_@1[2:7] = 3
37 - Goto bb1
36 + [8] Reassign mutate y$2_@1[2:9] = 3
37 + [9] Goto bb1
38 bb1:
39 predecessor blocks: bb2 bb3
40 - [7] Let mutate t$5_@4 = Object { x: read x$1_@0, y: read y$2_@1 }
41 - Return freeze t$5_@4
40 + [10] Let mutate t$5_@4 = Object { x: read x$1_@0, y: read y$2_@1 }
41 + [11] Return freeze t$5_@4
42 ```
43
44 ### CFG
@@ -48,8 +48,8 @@ flowchart TB
48 %% Basic Blocks
49 subgraph bb0
50 bb0_instrs["
51 - [1] Let mutate x$1_@0[1:6] = 1
52 - [2] Let mutate y$2_@1[2:7] = 2
51 + [1] Let mutate x$1_@0[1:7] = 1
52 + [2] Let mutate y$2_@1[2:9] = 2
53 [3] Const mutate $3_@2 = 1
54 [4] Const mutate $4_@3 = Binary read x$1_@0 > read $3_@2
55 "]
@@ -57,19 +57,19 @@ flowchart TB
57 end
58 subgraph bb2
59 bb2_instrs["
60 - [5] Reassign mutate x$1_@0[1:6] = 2
60 + [6] Reassign mutate x$1_@0[1:7] = 2
61 "]
62 bb2_instrs --> bb2_terminal(["Goto"])
63 end
64 subgraph bb3
65 bb3_instrs["
66 - [6] Reassign mutate y$2_@1[2:7] = 3
66 + [8] Reassign mutate y$2_@1[2:9] = 3
67 "]
68 bb3_instrs --> bb3_terminal(["Goto"])
69 end
70 subgraph bb1
71 bb1_instrs["
72 - [7] Let mutate t$5_@4 = Object { x: read x$1_@0, y: read y$2_@1 }
72 + [10] Let mutate t$5_@4 = Object { x: read x$1_@0, y: read y$2_@1 }
73 "]
74 bb1_instrs --> bb1_terminal(["Return freeze t$5_@4"])
75 end
compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression.expect.md
+1 -1
@@ -18,7 +18,7 @@ bb0:
18 [1] Const mutate a$2_@0 = 1
19 [2] Const mutate b$3_@1 = 2
20 [3] Const mutate x$4_@2 = Object { a: read a$2_@0, b: read b$3_@1 }
21 - Return freeze x$4_@2
21 + [4] Return freeze x$4_@2
22 ```
23
24 ### CFG
compiler/forget/src/__tests__/fixtures/hir/ssa-property-call.expect.md
+1 -1
@@ -19,7 +19,7 @@ bb0:
19 [2] Const mutate y$2_@1[2:5] = Object { x: read x$1_@0 }
20 [3] Const mutate $3_@1[2:5] = Array []
21 [4] Call mutate y$2_@1.x.push(mutate $3_@1)
22 - Return freeze y$2_@1
22 + [5] Return freeze y$2_@1
23 ```
24
25 ### CFG
compiler/forget/src/__tests__/fixtures/hir/ssa-property.expect.md
+1 -1
@@ -18,7 +18,7 @@ bb0:
18 [1] Const mutate x$1_@0 = Array []
19 [2] Const mutate y$2_@1[2:4] = Object { }
20 [3] Reassign mutate y$2_@1.x[2:4] = read x$1_@0
21 - Return freeze y$2_@1
21 + [4] Return freeze y$2_@1
22 ```
23
24 ### CFG
compiler/forget/src/__tests__/fixtures/hir/ssa-return.expect.md
+7 -7
@@ -17,17 +17,17 @@ function foo() {
17
18 ```
19 bb0:
20 - [1] Let mutate x$1_@0[1:5] = 1
20 + [1] Let mutate x$1_@0[1:6] = 1
21 [2] Const mutate $2_@1 = 1
22 [3] Const mutate $3_@2 = Binary read x$1_@0 === read $2_@1
23 - If (read $3_@2) then:bb2 else:bb1
23 + [4] If (read $3_@2) then:bb2 else:bb1
24 bb2:
25 predecessor blocks: bb0
26 - [4] Reassign mutate x$1_@0[1:5] = 2
27 - Goto bb1
26 + [5] Reassign mutate x$1_@0[1:6] = 2
27 + [6] Goto bb1
28 bb1:
29 predecessor blocks: bb2 bb0
30 - Return read x$1_@0
30 + [7] Return read x$1_@0
31 ```
32
33 ### CFG
@@ -37,7 +37,7 @@ flowchart TB
37 %% Basic Blocks
38 subgraph bb0
39 bb0_instrs["
40 - [1] Let mutate x$1_@0[1:5] = 1
40 + [1] Let mutate x$1_@0[1:6] = 1
41 [2] Const mutate $2_@1 = 1
42 [3] Const mutate $3_@2 = Binary read x$1_@0 === read $2_@1
43 "]
@@ -45,7 +45,7 @@ flowchart TB
45 end
46 subgraph bb2
47 bb2_instrs["
48 - [4] Reassign mutate x$1_@0[1:5] = 2
48 + [5] Reassign mutate x$1_@0[1:6] = 2
49 "]
50 bb2_instrs --> bb2_terminal(["Goto"])
51 end
compiler/forget/src/__tests__/fixtures/hir/ssa-shadowing.expect.md
+15 -15
@@ -21,7 +21,7 @@ function Foo(cond) {
21
22 ```
23 bb0:
24 - Return
24 + [1] Return
25 ```
26
27 ### CFG
@@ -49,21 +49,21 @@ function log$0() {
49
50 ```
51 bb0:
52 - [1] Let mutate str$2_@0[1:5] = ""
53 - If (read cond$1) then:bb2 else:bb3
52 + [1] Let mutate str$2_@0[1:7] = ""
53 + [2] If (read cond$1) then:bb2 else:bb3
54 bb2:
55 predecessor blocks: bb0
56 - [2] Let mutate str$3_@1 = "other test"
57 - [3] Call mutate log$4_@2(read str$3_@1)
58 - Goto bb1
56 + [3] Let mutate str$3_@1 = "other test"
57 + [4] Call mutate log$4_@2(read str$3_@1)
58 + [5] Goto bb1
59 bb3:
60 predecessor blocks: bb0
61 - [4] Reassign mutate str$2_@0[1:5] = "fallthrough test"
62 - Goto bb1
61 + [6] Reassign mutate str$2_@0[1:7] = "fallthrough test"
62 + [7] Goto bb1
63 bb1:
64 predecessor blocks: bb2 bb3
65 - [5] Call mutate log$4_@2(read str$2_@0)
66 - Return
65 + [8] Call mutate log$4_@2(read str$2_@0)
66 + [9] Return
67 ```
68
69 ### CFG
@@ -73,26 +73,26 @@ flowchart TB
73 %% Basic Blocks
74 subgraph bb0
75 bb0_instrs["
76 - [1] Let mutate str$2_@0[1:5] = ''
76 + [1] Let mutate str$2_@0[1:7] = ''
77 "]
78 bb0_instrs --> bb0_terminal(["If (read cond$1)"])
79 end
80 subgraph bb2
81 bb2_instrs["
82 - [2] Let mutate str$3_@1 = 'other test'
83 - [3] Call mutate log$4_@2(read str$3_@1)
82 + [3] Let mutate str$3_@1 = 'other test'
83 + [4] Call mutate log$4_@2(read str$3_@1)
84 "]
85 bb2_instrs --> bb2_terminal(["Goto"])
86 end
87 subgraph bb3
88 bb3_instrs["
89 - [4] Reassign mutate str$2_@0[1:5] = 'fallthrough test'
89 + [6] Reassign mutate str$2_@0[1:7] = 'fallthrough test'
90 "]
91 bb3_instrs --> bb3_terminal(["Goto"])
92 end
93 subgraph bb1
94 bb1_instrs["
95 - [5] Call mutate log$4_@2(read str$2_@0)
95 + [8] Call mutate log$4_@2(read str$2_@0)
96 "]
97 bb1_instrs --> bb1_terminal(["Return"])
98 end
compiler/forget/src/__tests__/fixtures/hir/ssa-simple-phi.expect.md
+10 -10
@@ -23,19 +23,19 @@ bb0:
23 [1] Let mutate y$1_@0 = 2
24 [2] Const mutate $2_@1 = 1
25 [3] Const mutate $3_@2 = Binary read y$1_@0 > read $2_@1
26 - If (read $3_@2) then:bb2 else:bb3
26 + [4] If (read $3_@2) then:bb2 else:bb3
27 bb2:
28 predecessor blocks: bb0
29 - [4] Reassign mutate y$1_@3[4:7] = 1
30 - Goto bb1
29 + [5] Reassign mutate y$1_@3[5:10] = 1
30 + [6] Goto bb1
31 bb3:
32 predecessor blocks: bb0
33 - [5] Reassign mutate y$1_@3[4:7] = 2
34 - Goto bb1
33 + [7] Reassign mutate y$1_@3[5:10] = 2
34 + [8] Goto bb1
35 bb1:
36 predecessor blocks: bb2 bb3
37 - [6] Let mutate x$4_@3[4:7] = read y$1_@3
38 - Return
37 + [9] Let mutate x$4_@3[5:10] = read y$1_@3
38 + [10] Return
39 ```
40
41 ### CFG
@@ -53,19 +53,19 @@ flowchart TB
53 end
54 subgraph bb2
55 bb2_instrs["
56 - [4] Reassign mutate y$1_@3[4:7] = 1
56 + [5] Reassign mutate y$1_@3[5:10] = 1
57 "]
58 bb2_instrs --> bb2_terminal(["Goto"])
59 end
60 subgraph bb3
61 bb3_instrs["
62 - [5] Reassign mutate y$1_@3[4:7] = 2
62 + [7] Reassign mutate y$1_@3[5:10] = 2
63 "]
64 bb3_instrs --> bb3_terminal(["Goto"])
65 end
66 subgraph bb1
67 bb1_instrs["
68 - [6] Let mutate x$4_@3[4:7] = read y$1_@3
68 + [9] Let mutate x$4_@3[5:10] = read y$1_@3
69 "]
70 bb1_instrs --> bb1_terminal(["Return"])
71 end
compiler/forget/src/__tests__/fixtures/hir/ssa-simple.expect.md
+1 -1
@@ -15,7 +15,7 @@ function foo() {
15 bb0:
16 [1] Let mutate x$1_@0 = 1
17 [2] Let mutate y$2_@1 = 2
18 - Return
18 + [3] Return
19 ```
20
21 ### CFG
compiler/forget/src/__tests__/fixtures/hir/ssa-single-if.expect.md
+5 -5
@@ -19,14 +19,14 @@ function foo() {
19 bb0:
20 [1] Let mutate x$1_@0 = 1
21 [2] Let mutate y$2_@1 = 2
22 - If (read y$2_@1) then:bb2 else:bb1
22 + [3] If (read y$2_@1) then:bb2 else:bb1
23 bb2:
24 predecessor blocks: bb0
25 - [3] Let mutate z$3_@2 = Binary read x$1_@0 + read y$2_@1
26 - Goto bb1
25 + [4] Let mutate z$3_@2 = Binary read x$1_@0 + read y$2_@1
26 + [5] Goto bb1
27 bb1:
28 predecessor blocks: bb2 bb0
29 - Return
29 + [6] Return
30 ```
31
32 ### CFG
@@ -43,7 +43,7 @@ flowchart TB
43 end
44 subgraph bb2
45 bb2_instrs["
46 - [3] Let mutate z$3_@2 = Binary read x$1_@0 + read y$2_@1
46 + [4] Let mutate z$3_@2 = Binary read x$1_@0 + read y$2_@1
47 "]
48 bb2_instrs --> bb2_terminal(["Goto"])
49 end
compiler/forget/src/__tests__/fixtures/hir/ssa-switch.expect.md
+19 -19
@@ -33,29 +33,29 @@ bb0:
33 [3] Const mutate $5_@2 = Binary read x$1_@0 === read $4_@1
34 [4] Const mutate $7_@3 = 1
35 [5] Const mutate $8_@4 = Binary read x$1_@0 === read $7_@3
36 - Switch (read x$1_@0)
36 + [6] Switch (read x$1_@0)
37 Case read $8_@4: bb5
38 Case read $5_@2: bb3
39 Default: bb2
40 bb5:
41 predecessor blocks: bb0
42 - [6] Const mutate $6_@5 = 1
43 - [7] Reassign mutate x$1_@6[7:13] = Binary read x$1_@0 + read $6_@5
44 - Goto bb1
42 + [7] Const mutate $6_@5 = 1
43 + [8] Reassign mutate x$1_@6[8:17] = Binary read x$1_@0 + read $6_@5
44 + [9] Goto bb1
45 bb3:
46 predecessor blocks: bb0
47 - [8] Const mutate $3_@7 = 2
48 - [9] Reassign mutate x$1_@6[7:13] = Binary read x$1_@0 + read $3_@7
49 - Goto bb1
47 + [10] Const mutate $3_@7 = 2
48 + [11] Reassign mutate x$1_@6[8:17] = Binary read x$1_@0 + read $3_@7
49 + [12] Goto bb1
50 bb2:
51 predecessor blocks: bb0
52 - [10] Const mutate $2_@8 = 3
53 - [11] Reassign mutate x$1_@6[7:13] = Binary read x$1_@0 + read $2_@8
54 - Goto bb1
52 + [13] Const mutate $2_@8 = 3
53 + [14] Reassign mutate x$1_@6[8:17] = Binary read x$1_@0 + read $2_@8
54 + [15] Goto bb1
55 bb1:
56 predecessor blocks: bb5 bb3 bb2
57 - [12] Let mutate y$9_@6[7:13] = read x$1_@6
58 - Return
57 + [16] Let mutate y$9_@6[8:17] = read x$1_@6
58 + [17] Return
59 ```
60
61 ### CFG
@@ -75,28 +75,28 @@ flowchart TB
75 end
76 subgraph bb5
77 bb5_instrs["
78 - [6] Const mutate $6_@5 = 1
79 - [7] Reassign mutate x$1_@6[7:13] = Binary read x$1_@0 + read $6_@5
78 + [7] Const mutate $6_@5 = 1
79 + [8] Reassign mutate x$1_@6[8:17] = Binary read x$1_@0 + read $6_@5
80 "]
81 bb5_instrs --> bb5_terminal(["Goto"])
82 end
83 subgraph bb3
84 bb3_instrs["
85 - [8] Const mutate $3_@7 = 2
86 - [9] Reassign mutate x$1_@6[7:13] = Binary read x$1_@0 + read $3_@7
85 + [10] Const mutate $3_@7 = 2
86 + [11] Reassign mutate x$1_@6[8:17] = Binary read x$1_@0 + read $3_@7
87 "]
88 bb3_instrs --> bb3_terminal(["Goto"])
89 end
90 subgraph bb2
91 bb2_instrs["
92 - [10] Const mutate $2_@8 = 3
93 - [11] Reassign mutate x$1_@6[7:13] = Binary read x$1_@0 + read $2_@8
92 + [13] Const mutate $2_@8 = 3
93 + [14] Reassign mutate x$1_@6[8:17] = Binary read x$1_@0 + read $2_@8
94 "]
95 bb2_instrs --> bb2_terminal(["Goto"])
96 end
97 subgraph bb1
98 bb1_instrs["
99 - [12] Let mutate y$9_@6[7:13] = read x$1_@6
99 + [16] Let mutate y$9_@6[8:17] = read x$1_@6
100 "]
101 bb1_instrs --> bb1_terminal(["Return"])
102 end
compiler/forget/src/__tests__/fixtures/hir/ssa-throw.expect.md
+7 -7
@@ -16,17 +16,17 @@ function foo() {
16
17 ```
18 bb0:
19 - [1] Let mutate x$1_@0[1:5] = 1
19 + [1] Let mutate x$1_@0[1:6] = 1
20 [2] Const mutate $2_@1 = 1
21 [3] Const mutate $3_@2 = Binary read x$1_@0 === read $2_@1
22 - If (read $3_@2) then:bb2 else:bb1
22 + [4] If (read $3_@2) then:bb2 else:bb1
23 bb2:
24 predecessor blocks: bb0
25 - [4] Reassign mutate x$1_@0[1:5] = 2
26 - Goto bb1
25 + [5] Reassign mutate x$1_@0[1:6] = 2
26 + [6] Goto bb1
27 bb1:
28 predecessor blocks: bb2 bb0
29 - Throw read x$1_@0
29 + [7] Throw read x$1_@0
30 ```
31
32 ### CFG
@@ -36,7 +36,7 @@ flowchart TB
36 %% Basic Blocks
37 subgraph bb0
38 bb0_instrs["
39 - [1] Let mutate x$1_@0[1:5] = 1
39 + [1] Let mutate x$1_@0[1:6] = 1
40 [2] Const mutate $2_@1 = 1
41 [3] Const mutate $3_@2 = Binary read x$1_@0 === read $2_@1
42 "]
@@ -44,7 +44,7 @@ flowchart TB
44 end
45 subgraph bb2
46 bb2_instrs["
47 - [4] Reassign mutate x$1_@0[1:5] = 2
47 + [5] Reassign mutate x$1_@0[1:6] = 2
48 "]
49 bb2_instrs --> bb2_terminal(["Goto"])
50 end
compiler/forget/src/__tests__/fixtures/hir/ssa-while-no-reassign.expect.md
+12 -12
@@ -18,20 +18,20 @@ function foo() {
18 ```
19 bb0:
20 [1] Let mutate x$1_@0 = 1
21 - While test=bb1 loop=bb3 fallthrough=bb2
21 + [2] While test=bb1 loop=bb3 fallthrough=bb2
22 bb1:
23 predecessor blocks: bb0 bb3
24 - [2] Const mutate $3_@1 = 10
25 - [3] Const mutate $4_@2 = Binary read x$1_@0 < read $3_@1
26 - If (read $4_@2) then:bb3 else:bb2
24 + [3] Const mutate $3_@1 = 10
25 + [4] Const mutate $4_@2 = Binary read x$1_@0 < read $3_@1
26 + [5] If (read $4_@2) then:bb3 else:bb2
27 bb3:
28 predecessor blocks: bb1
29 - [4] Const mutate $2_@3 = 1
30 - [5] Binary read x$1_@0 + read $2_@3
31 - Goto(Continue) bb1
29 + [6] Const mutate $2_@3 = 1
30 + [7] Binary read x$1_@0 + read $2_@3
31 + [8] Goto(Continue) bb1
32 bb2:
33 predecessor blocks: bb1
34 - Return read x$1_@0
34 + [9] Return read x$1_@0
35 ```
36
37 ### CFG
@@ -47,15 +47,15 @@ flowchart TB
47 end
48 subgraph bb1
49 bb1_instrs["
50 - [2] Const mutate $3_@1 = 10
51 - [3] Const mutate $4_@2 = Binary read x$1_@0 < read $3_@1
50 + [3] Const mutate $3_@1 = 10
51 + [4] Const mutate $4_@2 = Binary read x$1_@0 < read $3_@1
52 "]
53 bb1_instrs --> bb1_terminal(["If (read $4_@2)"])
54 end
55 subgraph bb3
56 bb3_instrs["
57 - [4] Const mutate $2_@3 = 1
58 - [5] Binary read x$1_@0 + read $2_@3
57 + [6] Const mutate $2_@3 = 1
58 + [7] Binary read x$1_@0 + read $2_@3
59 "]
60 bb3_instrs --> bb3_terminal(["Goto"])
61 end
compiler/forget/src/__tests__/fixtures/hir/ssa-while.expect.md
+14 -14
@@ -17,21 +17,21 @@ function foo() {
17
18 ```
19 bb0:
20 - [1] Let mutate x$1_@0[0:6] = 1
21 - While test=bb1 loop=bb3 fallthrough=bb2
20 + [1] Let mutate x$1_@0[0:8] = 1
21 + [2] While test=bb1 loop=bb3 fallthrough=bb2
22 bb1:
23 predecessor blocks: bb0 bb3
24 - [2] Const mutate $3_@1 = 10
25 - [3] Const mutate $4_@2 = Binary read x$1_@0 < read $3_@1
26 - If (read $4_@2) then:bb3 else:bb2
24 + [3] Const mutate $3_@1 = 10
25 + [4] Const mutate $4_@2 = Binary read x$1_@0 < read $3_@1
26 + [5] If (read $4_@2) then:bb3 else:bb2
27 bb3:
28 predecessor blocks: bb1
29 - [4] Const mutate $2_@3 = 1
30 - [5] Reassign mutate x$1_@0[0:6] = Binary read x$1_@0 + read $2_@3
31 - Goto(Continue) bb1
29 + [6] Const mutate $2_@3 = 1
30 + [7] Reassign mutate x$1_@0[0:8] = Binary read x$1_@0 + read $2_@3
31 + [8] Goto(Continue) bb1
32 bb2:
33 predecessor blocks: bb1
34 - Return read x$1_@0
34 + [9] Return read x$1_@0
35 ```
36
37 ### CFG
@@ -41,21 +41,21 @@ flowchart TB
41 %% Basic Blocks
42 subgraph bb0
43 bb0_instrs["
44 - [1] Let mutate x$1_@0[0:6] = 1
44 + [1] Let mutate x$1_@0[0:8] = 1
45 "]
46 bb0_instrs --> bb0_terminal(["While"])
47 end
48 subgraph bb1
49 bb1_instrs["
50 - [2] Const mutate $3_@1 = 10
51 - [3] Const mutate $4_@2 = Binary read x$1_@0 < read $3_@1
50 + [3] Const mutate $3_@1 = 10
51 + [4] Const mutate $4_@2 = Binary read x$1_@0 < read $3_@1
52 "]
53 bb1_instrs --> bb1_terminal(["If (read $4_@2)"])
54 end
55 subgraph bb3
56 bb3_instrs["
57 - [4] Const mutate $2_@3 = 1
58 - [5] Reassign mutate x$1_@0[0:6] = Binary read x$1_@0 + read $2_@3
57 + [6] Const mutate $2_@3 = 1
58 + [7] Reassign mutate x$1_@0[0:8] = Binary read x$1_@0 + read $2_@3
59 "]
60 bb3_instrs --> bb3_terminal(["Goto"])
61 end
compiler/forget/src/__tests__/fixtures/hir/switch-non-final-default.expect.md
+20 -20
@@ -32,31 +32,31 @@ function Component(props) {
32
33 ```
34 bb0:
35 - [1] Let mutate x$2_@0[1:9] = Array []
36 - [2] Let mutate y$3_@0[1:9] = undefined
35 + [1] Let mutate x$2_@0[1:11] = Array []
36 + [2] Let mutate y$3_@0[1:11] = undefined
37 [3] Const mutate $4_@1 = false
38 [4] Const mutate $5_@2 = true
39 [5] Const mutate $6_@3 = 1
40 - Switch (read props$1.p0)
40 + [6] Switch (read props$1.p0)
41 Case read $6_@3: bb1
42 Case read $5_@2: bb6
43 Default: bb1
44 Case read $4_@1: bb2
45 bb6:
46 predecessor blocks: bb0
47 - [6] Call mutate x$2_@0.push(read props$1.p2)
48 - [7] Reassign mutate y$3_@0[1:9] = Array []
49 - Goto bb1
47 + [7] Call mutate x$2_@0.push(read props$1.p2)
48 + [8] Reassign mutate y$3_@0[1:11] = Array []
49 + [9] Goto bb1
50 bb2:
51 predecessor blocks: bb0
52 - [8] Reassign mutate y$3_@0[1:9] = read x$2_@0
53 - Goto bb1
52 + [10] Reassign mutate y$3_@0[1:11] = read x$2_@0
53 + [11] Goto bb1
54 bb1:
55 predecessor blocks: bb0 bb6 bb2
56 - [9] Const mutate child$7_@4 = JSX <read Component$0 data={freeze x$2_@0} ></read Component$0>
57 - [10] Call read y$3_@0.push(read props$1.p4)
58 - [11] Const mutate $8_@5 = JSX <read Component$0 data={freeze y$3_@0} >{read child$7_@4}</read Component$0>
59 - Return read $8_@5
56 + [12] Const mutate child$7_@4 = JSX <read Component$0 data={freeze x$2_@0} ></read Component$0>
57 + [13] Call read y$3_@0.push(read props$1.p4)
58 + [14] Const mutate $8_@5 = JSX <read Component$0 data={freeze y$3_@0} >{read child$7_@4}</read Component$0>
59 + [15] Return read $8_@5
60 ```
61
62 ### CFG
@@ -66,8 +66,8 @@ flowchart TB
66 %% Basic Blocks
67 subgraph bb0
68 bb0_instrs["
69 - [1] Let mutate x$2_@0[1:9] = Array []
70 - [2] Let mutate y$3_@0[1:9] = undefined
69 + [1] Let mutate x$2_@0[1:11] = Array []
70 + [2] Let mutate y$3_@0[1:11] = undefined
71 [3] Const mutate $4_@1 = false
72 [4] Const mutate $5_@2 = true
73 [5] Const mutate $6_@3 = 1
@@ -76,22 +76,22 @@ flowchart TB
76 end
77 subgraph bb6
78 bb6_instrs["
79 - [6] Call mutate x$2_@0.push(read props$1.p2)
80 - [7] Reassign mutate y$3_@0[1:9] = Array []
79 + [7] Call mutate x$2_@0.push(read props$1.p2)
80 + [8] Reassign mutate y$3_@0[1:11] = Array []
81 "]
82 bb6_instrs --> bb6_terminal(["Goto"])
83 end
84 subgraph bb2
85 bb2_instrs["
86 - [8] Reassign mutate y$3_@0[1:9] = read x$2_@0
86 + [10] Reassign mutate y$3_@0[1:11] = read x$2_@0
87 "]
88 bb2_instrs --> bb2_terminal(["Goto"])
89 end
90 subgraph bb1
91 bb1_instrs["
92 - [9] Const mutate child$7_@4 = JSX <read Component$0 data={freeze x$2_@0} ></read Component$0>
93 - [10] Call read y$3_@0.push(read props$1.p4)
94 - [11] Const mutate $8_@5 = JSX <read Component$0 data={freeze y$3_@0} >{read child$7_@4}</read Component$0>
92 + [12] Const mutate child$7_@4 = JSX <read Component$0 data={freeze x$2_@0} ></read Component$0>
93 + [13] Call read y$3_@0.push(read props$1.p4)
94 + [14] Const mutate $8_@5 = JSX <read Component$0 data={freeze y$3_@0} >{read child$7_@4}</read Component$0>
95 "]
96 bb1_instrs --> bb1_terminal(["Return read $8_@5"])
97 end
compiler/forget/src/__tests__/fixtures/hir/switch-with-fallthrough.expect.md
+20 -20
@@ -43,7 +43,7 @@ bb0:
43 [5] Const mutate $6_@4 = 2
44 [6] Const mutate $7_@5 = 1
45 [7] Const mutate $8_@6 = 0
46 - Switch (read x$1)
46 + [8] Switch (read x$1)
47 Case read $8_@6: bb10
48 Case read $7_@5: bb9
49 Case read $6_@4: bb1
@@ -53,31 +53,31 @@ bb0:
53 Default: bb2
54 bb10:
55 predecessor blocks: bb0
56 - [8] Reassign mutate y$2_@7 = 0
57 - Goto bb9
56 + [9] Reassign mutate y$2_@7 = 0
57 + [10] Goto bb9
58 bb9:
59 predecessor blocks: bb10 bb0
60 - [9] Reassign mutate y$2_@8 = 1
61 - Goto bb1
60 + [11] Reassign mutate y$2_@8 = 1
61 + [12] Goto bb1
62 bb5:
63 predecessor blocks: bb0
64 - [10] Reassign mutate y$2_@9 = 3
65 - Goto bb1
64 + [13] Reassign mutate y$2_@9 = 3
65 + [14] Goto bb1
66 bb4:
67 predecessor blocks: bb0
68 - [11] Reassign mutate y$2_@10 = 4
69 - Goto bb3
68 + [15] Reassign mutate y$2_@10 = 4
69 + [16] Goto bb3
70 bb3:
71 predecessor blocks: bb4 bb0
72 - [12] Reassign mutate y$2_@11 = 5
73 - Goto bb2
72 + [17] Reassign mutate y$2_@11 = 5
73 + [18] Goto bb2
74 bb2:
75 predecessor blocks: bb3 bb0
76 - [13] Reassign mutate y$2_@12 = 0
77 - Goto bb1
76 + [19] Reassign mutate y$2_@12 = 0
77 + [20] Goto bb1
78 bb1:
79 predecessor blocks: bb9 bb0 bb5 bb2
80 - Return
80 + [21] Return
81 ```
82
83 ### CFG
@@ -99,37 +99,37 @@ flowchart TB
99 end
100 subgraph bb10
101 bb10_instrs["
102 - [8] Reassign mutate y$2_@7 = 0
102 + [9] Reassign mutate y$2_@7 = 0
103 "]
104 bb10_instrs --> bb10_terminal(["Goto"])
105 end
106 subgraph bb9
107 bb9_instrs["
108 - [9] Reassign mutate y$2_@8 = 1
108 + [11] Reassign mutate y$2_@8 = 1
109 "]
110 bb9_instrs --> bb9_terminal(["Goto"])
111 end
112 subgraph bb5
113 bb5_instrs["
114 - [10] Reassign mutate y$2_@9 = 3
114 + [13] Reassign mutate y$2_@9 = 3
115 "]
116 bb5_instrs --> bb5_terminal(["Goto"])
117 end
118 subgraph bb4
119 bb4_instrs["
120 - [11] Reassign mutate y$2_@10 = 4
120 + [15] Reassign mutate y$2_@10 = 4
121 "]
122 bb4_instrs --> bb4_terminal(["Goto"])
123 end
124 subgraph bb3
125 bb3_instrs["
126 - [12] Reassign mutate y$2_@11 = 5
126 + [17] Reassign mutate y$2_@11 = 5
127 "]
128 bb3_instrs --> bb3_terminal(["Goto"])
129 end
130 subgraph bb2
131 bb2_instrs["
132 - [13] Reassign mutate y$2_@12 = 0
132 + [19] Reassign mutate y$2_@12 = 0
133 "]
134 bb2_instrs --> bb2_terminal(["Goto"])
135 end
compiler/forget/src/__tests__/fixtures/hir/switch.expect.md
+22 -22
@@ -28,30 +28,30 @@ function Component(props) {
28
29 ```
30 bb0:
31 - [1] Let mutate x$2_@0[1:9] = Array []
32 - [2] Let mutate y$3_@0[1:9] = undefined
31 + [1] Let mutate x$2_@0[1:11] = Array []
32 + [2] Let mutate y$3_@0[1:11] = undefined
33 [3] Const mutate $4_@1 = false
34 [4] Const mutate $5_@2 = true
35 - Switch (read props$1.p0)
35 + [5] Switch (read props$1.p0)
36 Case read $5_@2: bb4
37 Case read $4_@1: bb2
38 Default: bb1
39 bb4:
40 predecessor blocks: bb0
41 - [5] Call mutate x$2_@0.push(read props$1.p2)
42 - [6] Call mutate x$2_@0.push(read props$1.p3)
43 - [7] Reassign mutate y$3_@3 = Array []
44 - Goto bb2
41 + [6] Call mutate x$2_@0.push(read props$1.p2)
42 + [7] Call mutate x$2_@0.push(read props$1.p3)
43 + [8] Reassign mutate y$3_@3 = Array []
44 + [9] Goto bb2
45 bb2:
46 predecessor blocks: bb4 bb0
47 - [8] Reassign mutate y$3_@0[1:9] = read x$2_@0
48 - Goto bb1
47 + [10] Reassign mutate y$3_@0[1:11] = read x$2_@0
48 + [11] Goto bb1
49 bb1:
50 predecessor blocks: bb2 bb0
51 - [9] Const mutate child$6_@4 = JSX <read Component$0 data={freeze x$2_@0} ></read Component$0>
52 - [10] Call read y$3_@0.push(read props$1.p4)
53 - [11] Const mutate $7_@5 = JSX <read Component$0 data={read y$3_@0} >{read child$6_@4}</read Component$0>
54 - Return read $7_@5
51 + [12] Const mutate child$6_@4 = JSX <read Component$0 data={freeze x$2_@0} ></read Component$0>
52 + [13] Call read y$3_@0.push(read props$1.p4)
53 + [14] Const mutate $7_@5 = JSX <read Component$0 data={read y$3_@0} >{read child$6_@4}</read Component$0>
54 + [15] Return read $7_@5
55 ```
56
57 ### CFG
@@ -61,8 +61,8 @@ flowchart TB
61 %% Basic Blocks
62 subgraph bb0
63 bb0_instrs["
64 - [1] Let mutate x$2_@0[1:9] = Array []
65 - [2] Let mutate y$3_@0[1:9] = undefined
64 + [1] Let mutate x$2_@0[1:11] = Array []
65 + [2] Let mutate y$3_@0[1:11] = undefined
66 [3] Const mutate $4_@1 = false
67 [4] Const mutate $5_@2 = true
68 "]
@@ -70,23 +70,23 @@ flowchart TB
70 end
71 subgraph bb4
72 bb4_instrs["
73 - [5] Call mutate x$2_@0.push(read props$1.p2)
74 - [6] Call mutate x$2_@0.push(read props$1.p3)
75 - [7] Reassign mutate y$3_@3 = Array []
73 + [6] Call mutate x$2_@0.push(read props$1.p2)
74 + [7] Call mutate x$2_@0.push(read props$1.p3)
75 + [8] Reassign mutate y$3_@3 = Array []
76 "]
77 bb4_instrs --> bb4_terminal(["Goto"])
78 end
79 subgraph bb2
80 bb2_instrs["
81 - [8] Reassign mutate y$3_@0[1:9] = read x$2_@0
81 + [10] Reassign mutate y$3_@0[1:11] = read x$2_@0
82 "]
83 bb2_instrs --> bb2_terminal(["Goto"])
84 end
85 subgraph bb1
86 bb1_instrs["
87 - [9] Const mutate child$6_@4 = JSX <read Component$0 data={freeze x$2_@0} ></read Component$0>
88 - [10] Call read y$3_@0.push(read props$1.p4)
89 - [11] Const mutate $7_@5 = JSX <read Component$0 data={read y$3_@0} >{read child$6_@4}</read Component$0>
87 + [12] Const mutate child$6_@4 = JSX <read Component$0 data={freeze x$2_@0} ></read Component$0>
88 + [13] Call read y$3_@0.push(read props$1.p4)
89 + [14] Const mutate $7_@5 = JSX <read Component$0 data={read y$3_@0} >{read child$6_@4}</read Component$0>
90 "]
91 bb1_instrs --> bb1_terminal(["Return read $7_@5"])
92 end
compiler/forget/src/__tests__/fixtures/hir/while-break.expect.md
+3 -3
@@ -15,13 +15,13 @@ function foo(a, b) {
15
16 ```
17 bb0:
18 - While test=bb1 loop=bb2 fallthrough=bb2
18 + [1] While test=bb1 loop=bb2 fallthrough=bb2
19 bb1:
20 predecessor blocks: bb0
21 - If (read a$1) then:bb2 else:bb2
21 + [2] If (read a$1) then:bb2 else:bb2
22 bb2:
23 predecessor blocks: bb1
24 - Return read b$2
24 + [3] Return read b$2
25 ```
26
27 ### CFG
compiler/forget/src/__tests__/fixtures/hir/while-conditional-continue.expect.md
+10 -10
@@ -19,24 +19,24 @@ function foo(a, b, c, d) {
19
20 ```
21 bb0:
22 - While test=bb1 loop=bb3 fallthrough=bb2
22 + [1] While test=bb1 loop=bb3 fallthrough=bb2
23 bb1:
24 predecessor blocks: bb0 bb5 bb4
25 - If (read a$1) then:bb3 else:bb2
25 + [2] If (read a$1) then:bb3 else:bb2
26 bb3:
27 predecessor blocks: bb1
28 - If (read b$2) then:bb5 else:bb4
28 + [3] If (read b$2) then:bb5 else:bb4
29 bb5:
30 predecessor blocks: bb3
31 - Goto(Continue) bb1
31 + [4] Goto(Continue) bb1
32 bb4:
33 predecessor blocks: bb3
34 - [1] Call read c$3()
35 - Goto(Continue) bb1
34 + [5] Call read c$3()
35 + [6] Goto(Continue) bb1
36 bb2:
37 predecessor blocks: bb1
38 - [2] Call read d$4()
39 - Return
38 + [7] Call read d$4()
39 + [8] Return
40 ```
41
42 ### CFG
@@ -58,13 +58,13 @@ flowchart TB
58 end
59 subgraph bb4
60 bb4_instrs["
61 - [1] Call read c$3()
61 + [5] Call read c$3()
62 "]
63 bb4_instrs --> bb4_terminal(["Goto"])
64 end
65 subgraph bb2
66 bb2_instrs["
67 - [2] Call read d$4()
67 + [7] Call read d$4()
68 "]
69 bb2_instrs --> bb2_terminal(["Return"])
70 end