[LeaveSSA] Process all phis in a block
I don't know if it's possible to write a test for this as I can't seem to get the codegen to change. For the following testcase: ``` function useFoo(setOne) { let x; let y; if (setOne) { x = 1; y = 3; } else { x = 2; y = 5; } return { x, y }; } ``` The LeaveSSA changes from: ``` .... bb1 (block): predecessor blocks: bb2 bb3 x$36:TPrimitive: phi(bb2: x$19, bb3: x$19) y$21[8:14]:TPrimitive: phi(bb2: y$21, bb3: y$21) ... ``` to ``` ... bb1 (block): predecessor blocks: bb2 bb3 x$36:TPrimitive: phi(bb2: x$19, bb3: x$19) y$38:TPrimitive: phi(bb2: y$21, bb3: y$21) ... ``` Notice how `y`'s reassignment got skipped previously.
Sathya Gunasekaran committed
Oct 24, 2023 at 16:09 UTC
3d3ad1b9ef6b5b7bd3e4859b5461deb138389e41
1 file changed
+1
-1
compiler/packages/babel-plugin-react-forget/src/SSA/LeaveSSA.ts
+1
-1
@@ -322,7 +322,7 @@ export function leaveSSA(fn: HIRFunction): void {
322
operand.mutableRange.end = phi.id.mutableRange.end;
323
}
324
}
325
- return;
325
+ continue;
326
}
327
// Otherwise this is a temporary phi (logical or ternary) or occurs in a loop. In either
328
// case we can't independently memoize any of the values: unify their ranges to span the