Increase precision in InferMutableRangesForAlias

Previously, this step just set the mutable range of any alias set including any 

mutation to the end of the last mutable range of any of the containing 
identifiers. 

This change makes it so that the ends are only updated of the ranges that end 

before the last mutation. 

Fixes #852
This commit is contained in:
Jan Kassens
2022-12-09 13:10:01 -05:00
parent 748992d508
commit 255700e2cd
10 changed files with 220 additions and 138 deletions
@@ -7,18 +7,25 @@ export function inferMutableRangesForAlias(aliases: DisjointSet<Identifier>) {
for (const aliasSet of aliasSets) {
// Update mutableRange.end only if the identifiers have actually been
// mutated.
const haveIdentifiersBeenMutated = [...aliasSet].some(
const mutatingIdentifiers = [...aliasSet].filter(
(id) => id.mutableRange.end - id.mutableRange.start > 1
);
if (haveIdentifiersBeenMutated) {
if (mutatingIdentifiers.length > 0) {
// Find final instruction which mutates this alias set.
const mutableRangeEnds = [...aliasSet].map((id) => id.mutableRange.end);
const maxMutableRangeEnd = Math.max(...mutableRangeEnds) as InstructionId;
let lastMutatingInstructionId = 0;
for (const id of mutatingIdentifiers) {
if (id.mutableRange.end > lastMutatingInstructionId) {
lastMutatingInstructionId = id.mutableRange.end;
}
}
// Update mutableRange.end for all aliases in this set.
// Update mutableRange.end for all aliases in this set ending before the
// last mutation.
for (const alias of aliasSet) {
alias.mutableRange.end = maxMutableRangeEnd;
if (alias.mutableRange.end < lastMutatingInstructionId) {
alias.mutableRange.end = lastMutatingInstructionId as InstructionId;
}
}
}
}
@@ -37,7 +37,7 @@ function Component(props) {
bb0:
[1] Const mutate items$27_@0 = read props$26.items
[2] Const mutate maxItems$28_@1 = read props$26.maxItems
[3] Const mutate renderedItems$29_@2[3:26] = Array []
[3] Const mutate renderedItems$29_@2[3:22] = Array []
[4] Const mutate seen$30_@3[0:19] = New mutate Set$6_@3()
[5] Const mutate $31_@4 = 0
[6] Const mutate max$32_@5[0:7] = Call mutate Math$8_@5.max(read $31_@4, read maxItems$28_@1)
@@ -71,23 +71,23 @@ bb4:
[19] Const mutate $43_@7 = "div"
[20] Const mutate $44_@8 = JSX <read $43_@7>{read item$10_@3}</read $43_@7>
[21] Call mutate renderedItems$29_@2.push(read $44_@8)
[22] Const mutate $49_@2[3:26] = Binary read renderedItems$29_@2.length >= read max$32_@5
[23] If (read $49_@2) then:bb2 else:bb10 fallthrough=bb10
[22] Const mutate $49_@9 = Binary read renderedItems$29_@2.length >= read max$32_@5
[23] If (read $49_@9) then:bb2 else:bb10 fallthrough=bb10
bb10:
predecessor blocks: bb4
[24] Goto(Continue) bb1
bb2:
predecessor blocks: bb4 bb1
[25] Const mutate count$52_@2[3:26] = read renderedItems$29_@2.length
[26] Const mutate $53_@9 = "div"
[27] Const mutate $54_@10 = "\n "
[28] Const mutate $55_@11 = "h1"
[29] Const mutate $56_@12 = " Items"
[30] Const mutate $57_@13 = JSX <read $55_@11>{freeze count$52_@2}{read $56_@12}</read $55_@11>
[31] Const mutate $58_@14 = "\n "
[32] Const mutate $59_@15 = "\n "
[33] Const mutate $60_@16 = JSX <read $53_@9>{read $54_@10}{read $57_@13}{read $58_@14}{freeze renderedItems$29_@2}{read $59_@15}</read $53_@9>
[34] Return read $60_@16
[25] Const mutate count$52_@10 = read renderedItems$29_@2.length
[26] Const mutate $53_@11 = "div"
[27] Const mutate $54_@12 = "\n "
[28] Const mutate $55_@13 = "h1"
[29] Const mutate $56_@14 = " Items"
[30] Const mutate $57_@15 = JSX <read $55_@13>{freeze count$52_@10}{read $56_@14}</read $55_@13>
[31] Const mutate $58_@16 = "\n "
[32] Const mutate $59_@17 = "\n "
[33] Const mutate $60_@18 = JSX <read $53_@11>{read $54_@12}{read $57_@15}{read $58_@16}{freeze renderedItems$29_@2}{read $59_@17}</read $53_@11>
[34] Return read $60_@18
scope0 [1:2]:
- read props$26.items
scope1 [2:3]:
@@ -103,7 +103,7 @@ flowchart TB
bb0_instrs["
[1] Const mutate items$27_@0 = read props$26.items
[2] Const mutate maxItems$28_@1 = read props$26.maxItems
[3] Const mutate renderedItems$29_@2[3:26] = Array []
[3] Const mutate renderedItems$29_@2[3:22] = Array []
[4] Const mutate seen$30_@3[0:19] = New mutate Set$6_@3()
[5] Const mutate $31_@4 = 0
[6] Const mutate max$32_@5[0:7] = Call mutate Math$8_@5.max(read $31_@4, read maxItems$28_@1)
@@ -145,26 +145,26 @@ flowchart TB
[19] Const mutate $43_@7 = 'div'
[20] Const mutate $44_@8 = JSX <read $43_@7>{read item$10_@3}</read $43_@7>
[21] Call mutate renderedItems$29_@2.push(read $44_@8)
[22] Const mutate $49_@2[3:26] = Binary read renderedItems$29_@2.length >= read max$32_@5
[22] Const mutate $49_@9 = Binary read renderedItems$29_@2.length >= read max$32_@5
"]
bb4_instrs --> bb4_terminal(["If (read $49_@2)"])
bb4_instrs --> bb4_terminal(["If (read $49_@9)"])
end
subgraph bb10
bb10_terminal(["Goto"])
end
subgraph bb2
bb2_instrs["
[25] Const mutate count$52_@2[3:26] = read renderedItems$29_@2.length
[26] Const mutate $53_@9 = 'div'
[27] Const mutate $54_@10 = '\n '
[28] Const mutate $55_@11 = 'h1'
[29] Const mutate $56_@12 = ' Items'
[30] Const mutate $57_@13 = JSX <read $55_@11>{freeze count$52_@2}{read $56_@12}</read $55_@11>
[31] Const mutate $58_@14 = '\n '
[32] Const mutate $59_@15 = '\n '
[33] Const mutate $60_@16 = JSX <read $53_@9>{read $54_@10}{read $57_@13}{read $58_@14}{freeze renderedItems$29_@2}{read $59_@15}</read $53_@9>
[25] Const mutate count$52_@10 = read renderedItems$29_@2.length
[26] Const mutate $53_@11 = 'div'
[27] Const mutate $54_@12 = '\n '
[28] Const mutate $55_@13 = 'h1'
[29] Const mutate $56_@14 = ' Items'
[30] Const mutate $57_@15 = JSX <read $55_@13>{freeze count$52_@10}{read $56_@14}</read $55_@13>
[31] Const mutate $58_@16 = '\n '
[32] Const mutate $59_@17 = '\n '
[33] Const mutate $60_@18 = JSX <read $53_@11>{read $54_@12}{read $57_@15}{read $58_@16}{freeze renderedItems$29_@2}{read $59_@17}</read $53_@11>
"]
bb2_instrs --> bb2_terminal(["Return read $60_@16"])
bb2_instrs --> bb2_terminal(["Return read $60_@18"])
end
%% Jumps
@@ -0,0 +1,61 @@
## Input
```javascript
function Component(c) {
let x = { c };
mutate(x);
let a = x;
let b = a;
}
```
## HIR
```
bb0:
[1] Const mutate x$7_@0[0:3] = Object { c: read c$6 }
[2] Call mutate mutate$3_@0(mutate x$7_@0)
[3] Const mutate a$8_@1 = read x$7_@0
[4] Const mutate b$9_@2 = read a$8_@1
[5] Return
scope1 [3:4]:
- read x$7_@0
scope2 [4:5]:
- read a$8_@1
```
### CFG
```mermaid
flowchart TB
%% Basic Blocks
subgraph bb0
bb0_instrs["
[1] Const mutate x$7_@0[0:3] = Object { c: read c$6 }
[2] Call mutate mutate$3_@0(mutate x$7_@0)
[3] Const mutate a$8_@1 = read x$7_@0
[4] Const mutate b$9_@2 = read a$8_@1
"]
bb0_instrs --> bb0_terminal(["Return"])
end
%% Jumps
%% empty
```
## Code
```javascript
function Component$0(c$6) {
const x$7 = {
c: c$6,
};
mutate$3(x$7);
const a$8 = x$7;
const b$9 = a$8;
}
```
@@ -0,0 +1,6 @@
function Component(c) {
let x = { c };
mutate(x);
let a = x;
let b = a;
}
@@ -21,14 +21,14 @@ function foo() {
```
bb0:
[1] Let mutate x$7_@0[1:14] = 1
[1] Let mutate x$7_@0[1:13] = 1
[2] Const mutate y$8_@1 = 2
[3] Const mutate $9_@2 = 2
[4] Const mutate $10_@3 = Binary read y$8_@1 === read $9_@2
[5] If (read $10_@3) then:bb2 else:bb1 fallthrough=bb1
bb2:
predecessor blocks: bb0
[6] Reassign mutate x$7_@0[1:14] = 3
[6] Reassign mutate x$7_@0[1:13] = 3
[7] Goto bb1
bb1:
predecessor blocks: bb2 bb0
@@ -37,11 +37,11 @@ bb1:
[10] If (read $14_@5) then:bb4 else:bb3 fallthrough=bb3
bb4:
predecessor blocks: bb1
[11] Reassign mutate x$7_@0[1:14] = 5
[11] Reassign mutate x$7_@0[1:13] = 5
[12] Goto bb3
bb3:
predecessor blocks: bb4 bb1
[13] Const mutate y$18_@0[1:14] = read x$7_@0
[13] Const mutate y$18_@6 = read x$7_@0
[14] Return
scope3 [4:5]:
- read y$8_@1
@@ -49,6 +49,8 @@ scope3 [4:5]:
scope5 [9:10]:
- read y$8_@1
- read $12_@4
scope6 [13:14]:
- read x$7_@0
```
### CFG
@@ -58,7 +60,7 @@ flowchart TB
%% Basic Blocks
subgraph bb0
bb0_instrs["
[1] Let mutate x$7_@0[1:14] = 1
[1] Let mutate x$7_@0[1:13] = 1
[2] Const mutate y$8_@1 = 2
[3] Const mutate $9_@2 = 2
[4] Const mutate $10_@3 = Binary read y$8_@1 === read $9_@2
@@ -67,7 +69,7 @@ flowchart TB
end
subgraph bb2
bb2_instrs["
[6] Reassign mutate x$7_@0[1:14] = 3
[6] Reassign mutate x$7_@0[1:13] = 3
"]
bb2_instrs --> bb2_terminal(["Goto"])
end
@@ -80,13 +82,13 @@ flowchart TB
end
subgraph bb4
bb4_instrs["
[11] Reassign mutate x$7_@0[1:14] = 5
[11] Reassign mutate x$7_@0[1:13] = 5
"]
bb4_instrs --> bb4_terminal(["Goto"])
end
subgraph bb3
bb3_instrs["
[13] Const mutate y$18_@0[1:14] = read x$7_@0
[13] Const mutate y$18_@6 = read x$7_@0
"]
bb3_instrs --> bb3_terminal(["Return"])
end
@@ -18,22 +18,24 @@ function foo() {
```
bb0:
[1] Let mutate x$5_@0[1:9] = 1
[1] Let mutate x$5_@0[1:8] = 1
[2] Const mutate y$6_@1 = 2
[3] Const mutate $7_@2 = 2
[4] Const mutate $8_@3 = Binary read y$6_@1 === read $7_@2
[5] If (read $8_@3) then:bb2 else:bb1 fallthrough=bb1
bb2:
predecessor blocks: bb0
[6] Reassign mutate x$5_@0[1:9] = 3
[6] Reassign mutate x$5_@0[1:8] = 3
[7] Goto bb1
bb1:
predecessor blocks: bb2 bb0
[8] Const mutate y$11_@0[1:9] = read x$5_@0
[8] Const mutate y$11_@4 = read x$5_@0
[9] Return
scope3 [4:5]:
- read y$6_@1
- read $7_@2
scope4 [8:9]:
- read x$5_@0
```
### CFG
@@ -43,7 +45,7 @@ flowchart TB
%% Basic Blocks
subgraph bb0
bb0_instrs["
[1] Let mutate x$5_@0[1:9] = 1
[1] Let mutate x$5_@0[1:8] = 1
[2] Const mutate y$6_@1 = 2
[3] Const mutate $7_@2 = 2
[4] Const mutate $8_@3 = Binary read y$6_@1 === read $7_@2
@@ -52,13 +54,13 @@ flowchart TB
end
subgraph bb2
bb2_instrs["
[6] Reassign mutate x$5_@0[1:9] = 3
[6] Reassign mutate x$5_@0[1:8] = 3
"]
bb2_instrs --> bb2_terminal(["Goto"])
end
subgraph bb1
bb1_instrs["
[8] Const mutate y$11_@0[1:9] = read x$5_@0
[8] Const mutate y$11_@4 = read x$5_@0
"]
bb1_instrs --> bb1_terminal(["Return"])
end
@@ -23,25 +23,27 @@ bb0:
[1] Const mutate y$5_@0 = 2
[2] Const mutate $6_@1 = 1
[3] Const mutate $7_@2 = Binary read y$5_@0 > read $6_@1
[4] Let mutate y$8_@3[4:10] = undefined
[4] Let mutate y$8_@3[4:9] = undefined
[4] If (read $7_@2) then:bb2 else:bb3 fallthrough=bb1
bb2:
predecessor blocks: bb0
[5] Reassign mutate y$8_@3[4:10] = 1
[5] Reassign mutate y$8_@3[4:9] = 1
[6] Goto bb1
bb3:
predecessor blocks: bb0
[7] Reassign mutate y$8_@3[4:10] = 2
[7] Reassign mutate y$8_@3[4:9] = 2
[8] Goto bb1
bb1:
predecessor blocks: bb2 bb3
[9] Const mutate x$11_@3[4:10] = read y$8_@3
[9] Const mutate x$11_@4 = read y$8_@3
[10] Return
scope2 [3:4]:
- read y$5_@0
- read $6_@1
scope3 [4:10]:
scope3 [4:9]:
- read $7_@2
scope4 [9:10]:
- read y$8_@3
```
### CFG
@@ -54,25 +56,25 @@ flowchart TB
[1] Const mutate y$5_@0 = 2
[2] Const mutate $6_@1 = 1
[3] Const mutate $7_@2 = Binary read y$5_@0 > read $6_@1
[4] Let mutate y$8_@3[4:10] = undefined
[4] Let mutate y$8_@3[4:9] = undefined
"]
bb0_instrs --> bb0_terminal(["If (read $7_@2)"])
end
subgraph bb2
bb2_instrs["
[5] Reassign mutate y$8_@3[4:10] = 1
[5] Reassign mutate y$8_@3[4:9] = 1
"]
bb2_instrs --> bb2_terminal(["Goto"])
end
subgraph bb3
bb3_instrs["
[7] Reassign mutate y$8_@3[4:10] = 2
[7] Reassign mutate y$8_@3[4:9] = 2
"]
bb3_instrs --> bb3_terminal(["Goto"])
end
subgraph bb1
bb1_instrs["
[9] Const mutate x$11_@3[4:10] = read y$8_@3
[9] Const mutate x$11_@4 = read y$8_@3
"]
bb1_instrs --> bb1_terminal(["Return"])
end
@@ -33,7 +33,7 @@ bb0:
[3] Const mutate $12_@2 = Binary read x$10_@0 === read $11_@1
[4] Const mutate $13_@3 = 1
[5] Const mutate $14_@4 = Binary read x$10_@0 === read $13_@3
[6] Let mutate x$16_@5[6:17] = undefined
[6] Let mutate x$16_@5[6:16] = undefined
[6] Switch (read x$10_@0)
Case read $14_@4: bb5
Case read $12_@2: bb3
@@ -42,21 +42,21 @@ bb0:
bb5:
predecessor blocks: bb0
[7] Const mutate $15_@6 = 1
[8] Reassign mutate x$16_@5[6:17] = Binary read x$10_@0 + read $15_@6
[8] Reassign mutate x$16_@5[6:16] = Binary read x$10_@0 + read $15_@6
[9] Goto bb1
bb3:
predecessor blocks: bb0
[10] Const mutate $17_@7 = 2
[11] Reassign mutate x$16_@5[6:17] = Binary read x$10_@0 + read $17_@7
[11] Reassign mutate x$16_@5[6:16] = Binary read x$10_@0 + read $17_@7
[12] Goto bb1
bb2:
predecessor blocks: bb0
[13] Const mutate $19_@8 = 3
[14] Reassign mutate x$16_@5[6:17] = Binary read x$10_@0 + read $19_@8
[14] Reassign mutate x$16_@5[6:16] = Binary read x$10_@0 + read $19_@8
[15] Goto bb1
bb1:
predecessor blocks: bb5 bb3 bb2
[16] Const mutate y$22_@5[6:17] = read x$16_@5
[16] Const mutate y$22_@9 = read x$16_@5
[17] Return
scope2 [3:4]:
- read x$10_@0
@@ -64,7 +64,7 @@ scope2 [3:4]:
scope4 [5:6]:
- read x$10_@0
- read $13_@3
scope5 [6:17]:
scope5 [6:16]:
- read x$10_@0
scope8 [13:14]:
- read x$10_@0
@@ -72,6 +72,8 @@ scope7 [10:11]:
- read x$10_@0
scope6 [7:8]:
- read x$10_@0
scope9 [16:17]:
- read x$16_@5
```
### CFG
@@ -86,34 +88,34 @@ flowchart TB
[3] Const mutate $12_@2 = Binary read x$10_@0 === read $11_@1
[4] Const mutate $13_@3 = 1
[5] Const mutate $14_@4 = Binary read x$10_@0 === read $13_@3
[6] Let mutate x$16_@5[6:17] = undefined
[6] Let mutate x$16_@5[6:16] = undefined
"]
bb0_instrs --> bb0_terminal(["Switch (read x$10_@0)"])
end
subgraph bb5
bb5_instrs["
[7] Const mutate $15_@6 = 1
[8] Reassign mutate x$16_@5[6:17] = Binary read x$10_@0 + read $15_@6
[8] Reassign mutate x$16_@5[6:16] = Binary read x$10_@0 + read $15_@6
"]
bb5_instrs --> bb5_terminal(["Goto"])
end
subgraph bb3
bb3_instrs["
[10] Const mutate $17_@7 = 2
[11] Reassign mutate x$16_@5[6:17] = Binary read x$10_@0 + read $17_@7
[11] Reassign mutate x$16_@5[6:16] = Binary read x$10_@0 + read $17_@7
"]
bb3_instrs --> bb3_terminal(["Goto"])
end
subgraph bb2
bb2_instrs["
[13] Const mutate $19_@8 = 3
[14] Reassign mutate x$16_@5[6:17] = Binary read x$10_@0 + read $19_@8
[14] Reassign mutate x$16_@5[6:16] = Binary read x$10_@0 + read $19_@8
"]
bb2_instrs --> bb2_terminal(["Goto"])
end
subgraph bb1
bb1_instrs["
[16] Const mutate y$22_@5[6:17] = read x$16_@5
[16] Const mutate y$22_@9 = read x$16_@5
"]
bb1_instrs --> bb1_terminal(["Return"])
end
@@ -32,44 +32,44 @@ function Component(props) {
```
bb0:
[1] Const mutate x$10_@0[1:12] = Array []
[2] Let mutate y$11_@0[1:12] = undefined
[3] Const mutate $12_@1 = false
[4] Const mutate $13_@2 = true
[5] Const mutate $14_@3 = 1
[1] Const mutate x$10_@1[1:12] = Array []
[2] Let mutate y$11_@1[1:12] = undefined
[3] Const mutate $12_@2 = false
[4] Const mutate $13_@3 = true
[5] Const mutate $14_@4 = 1
[6] Switch (read props$9.p0)
Case read $14_@3: bb1
Case read $13_@2: bb6
Case read $14_@4: bb1
Case read $13_@3: bb6
Default: bb1
Case read $12_@1: bb2
Case read $12_@2: bb2
Fallthrough: bb1
bb6:
predecessor blocks: bb0
[7] Call mutate x$10_@0.push(read props$9.p2)
[8] Reassign mutate y$11_@0[1:12] = Array []
[7] Call mutate x$10_@1.push(read props$9.p2)
[8] Reassign mutate y$11_@1[1:12] = Array []
[9] Goto bb1
bb2:
predecessor blocks: bb0
[10] Reassign mutate y$11_@0[1:12] = read x$10_@0
[10] Reassign mutate y$11_@1[1:12] = read x$10_@1
[11] Goto bb1
bb1:
predecessor blocks: bb0 bb6 bb2
[12] Const mutate child$19_@4 = JSX <read Component$0 data={freeze x$10_@0} ></read Component$0>
[13] Call read y$11_@0.push(read props$9.p4)
[14] Const mutate $22_@5 = JSX <read Component$0 data={freeze y$11_@0} >{read child$19_@4}</read Component$0>
[15] Return read $22_@5
scope0 [1:12]:
[12] Const mutate child$19_@5 = JSX <read Component$0 data={freeze x$10_@1} ></read Component$0>
[13] Call read y$11_@1.push(read props$9.p4)
[14] Const mutate $22_@6 = JSX <read Component$0 data={freeze y$11_@1} >{read child$19_@5}</read Component$0>
[15] Return read $22_@6
scope1 [1:12]:
- read props$9.p2
- read props$9.p0
scope4 [12:13]:
scope5 [12:13]:
- read Component$0
- freeze x$10_@0
- read y$11_@0.push
- freeze x$10_@1
- read y$11_@1.push
- read props$9.p4
scope5 [14:15]:
scope6 [14:15]:
- read Component$0
- freeze y$11_@0
- read child$19_@4
- freeze y$11_@1
- read child$19_@5
```
### CFG
@@ -79,41 +79,41 @@ flowchart TB
%% Basic Blocks
subgraph bb0
bb0_instrs["
[1] Const mutate x$10_@0[1:12] = Array []
[2] Let mutate y$11_@0[1:12] = undefined
[3] Const mutate $12_@1 = false
[4] Const mutate $13_@2 = true
[5] Const mutate $14_@3 = 1
[1] Const mutate x$10_@1[1:12] = Array []
[2] Let mutate y$11_@1[1:12] = undefined
[3] Const mutate $12_@2 = false
[4] Const mutate $13_@3 = true
[5] Const mutate $14_@4 = 1
"]
bb0_instrs --> bb0_terminal(["Switch (read props$9.p0)"])
end
subgraph bb6
bb6_instrs["
[7] Call mutate x$10_@0.push(read props$9.p2)
[8] Reassign mutate y$11_@0[1:12] = Array []
[7] Call mutate x$10_@1.push(read props$9.p2)
[8] Reassign mutate y$11_@1[1:12] = Array []
"]
bb6_instrs --> bb6_terminal(["Goto"])
end
subgraph bb2
bb2_instrs["
[10] Reassign mutate y$11_@0[1:12] = read x$10_@0
[10] Reassign mutate y$11_@1[1:12] = read x$10_@1
"]
bb2_instrs --> bb2_terminal(["Goto"])
end
subgraph bb1
bb1_instrs["
[12] Const mutate child$19_@4 = JSX <read Component$0 data={freeze x$10_@0} ></read Component$0>
[13] Call read y$11_@0.push(read props$9.p4)
[14] Const mutate $22_@5 = JSX <read Component$0 data={freeze y$11_@0} >{read child$19_@4}</read Component$0>
[12] Const mutate child$19_@5 = JSX <read Component$0 data={freeze x$10_@1} ></read Component$0>
[13] Call read y$11_@1.push(read props$9.p4)
[14] Const mutate $22_@6 = JSX <read Component$0 data={freeze y$11_@1} >{read child$19_@5}</read Component$0>
"]
bb1_instrs --> bb1_terminal(["Return read $22_@5"])
bb1_instrs --> bb1_terminal(["Return read $22_@6"])
end
%% Jumps
bb0_terminal -- "read $14_@3" --> bb1
bb0_terminal -- "read $13_@2" --> bb6
bb0_terminal -- "read $14_@4" --> bb1
bb0_terminal -- "read $13_@3" --> bb6
bb0_terminal -- "default" --> bb1
bb0_terminal -- "read $12_@1" --> bb2
bb0_terminal -- "read $12_@2" --> bb2
bb0_terminal -- "fallthrough" --> bb1
bb6_terminal --> bb1
bb2_terminal --> bb1
@@ -28,44 +28,44 @@ function Component(props) {
```
bb0:
[1] Const mutate x$9_@0[1:12] = Array []
[2] Let mutate y$10_@0[1:12] = undefined
[3] Const mutate $11_@1 = false
[4] Const mutate $12_@2 = true
[1] Const mutate x$9_@1[1:12] = Array []
[2] Let mutate y$10_@1[1:12] = undefined
[3] Const mutate $11_@2 = false
[4] Const mutate $12_@3 = true
[5] Switch (read props$8.p0)
Case read $12_@2: bb4
Case read $11_@1: bb2
Case read $12_@3: bb4
Case read $11_@2: bb2
Default: bb1
Fallthrough: bb1
bb4:
predecessor blocks: bb0
[6] Call mutate x$9_@0.push(read props$8.p2)
[7] Call mutate x$9_@0.push(read props$8.p3)
[8] Const mutate y$13_@3 = Array []
[6] Call mutate x$9_@1.push(read props$8.p2)
[7] Call mutate x$9_@1.push(read props$8.p3)
[8] Const mutate y$13_@4 = Array []
[9] Goto bb2
bb2:
predecessor blocks: bb4 bb0
[10] Reassign mutate y$10_@0[1:12] = read x$9_@0
[10] Reassign mutate y$10_@1[1:12] = read x$9_@1
[11] Goto bb1
bb1:
predecessor blocks: bb2 bb0
[12] Const mutate child$19_@4 = JSX <read Component$0 data={freeze x$9_@0} ></read Component$0>
[13] Call read y$10_@0.push(read props$8.p4)
[14] Const mutate $23_@5 = JSX <read Component$0 data={read y$10_@0} >{read child$19_@4}</read Component$0>
[15] Return read $23_@5
scope0 [1:12]:
[12] Const mutate child$19_@5 = JSX <read Component$0 data={freeze x$9_@1} ></read Component$0>
[13] Call read y$10_@1.push(read props$8.p4)
[14] Const mutate $23_@6 = JSX <read Component$0 data={read y$10_@1} >{read child$19_@5}</read Component$0>
[15] Return read $23_@6
scope1 [1:12]:
- read props$8.p2
- read props$8.p3
- read props$8.p0
scope4 [12:13]:
scope5 [12:13]:
- read Component$0
- freeze x$9_@0
- read y$10_@0.push
- freeze x$9_@1
- read y$10_@1.push
- read props$8.p4
scope5 [14:15]:
scope6 [14:15]:
- read Component$0
- read y$10_@0
- read child$19_@4
- read y$10_@1
- read child$19_@5
```
### CFG
@@ -75,39 +75,39 @@ flowchart TB
%% Basic Blocks
subgraph bb0
bb0_instrs["
[1] Const mutate x$9_@0[1:12] = Array []
[2] Let mutate y$10_@0[1:12] = undefined
[3] Const mutate $11_@1 = false
[4] Const mutate $12_@2 = true
[1] Const mutate x$9_@1[1:12] = Array []
[2] Let mutate y$10_@1[1:12] = undefined
[3] Const mutate $11_@2 = false
[4] Const mutate $12_@3 = true
"]
bb0_instrs --> bb0_terminal(["Switch (read props$8.p0)"])
end
subgraph bb4
bb4_instrs["
[6] Call mutate x$9_@0.push(read props$8.p2)
[7] Call mutate x$9_@0.push(read props$8.p3)
[8] Const mutate y$13_@3 = Array []
[6] Call mutate x$9_@1.push(read props$8.p2)
[7] Call mutate x$9_@1.push(read props$8.p3)
[8] Const mutate y$13_@4 = Array []
"]
bb4_instrs --> bb4_terminal(["Goto"])
end
subgraph bb2
bb2_instrs["
[10] Reassign mutate y$10_@0[1:12] = read x$9_@0
[10] Reassign mutate y$10_@1[1:12] = read x$9_@1
"]
bb2_instrs --> bb2_terminal(["Goto"])
end
subgraph bb1
bb1_instrs["
[12] Const mutate child$19_@4 = JSX <read Component$0 data={freeze x$9_@0} ></read Component$0>
[13] Call read y$10_@0.push(read props$8.p4)
[14] Const mutate $23_@5 = JSX <read Component$0 data={read y$10_@0} >{read child$19_@4}</read Component$0>
[12] Const mutate child$19_@5 = JSX <read Component$0 data={freeze x$9_@1} ></read Component$0>
[13] Call read y$10_@1.push(read props$8.p4)
[14] Const mutate $23_@6 = JSX <read Component$0 data={read y$10_@1} >{read child$19_@5}</read Component$0>
"]
bb1_instrs --> bb1_terminal(["Return read $23_@5"])
bb1_instrs --> bb1_terminal(["Return read $23_@6"])
end
%% Jumps
bb0_terminal -- "read $12_@2" --> bb4
bb0_terminal -- "read $11_@1" --> bb2
bb0_terminal -- "read $12_@3" --> bb4
bb0_terminal -- "read $11_@2" --> bb2
bb0_terminal -- "default" --> bb1
bb0_terminal -- "fallthrough" --> bb1
bb4_terminal --> bb2