mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[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.
This commit is contained in:
@@ -322,7 +322,7 @@ export function leaveSSA(fn: HIRFunction): void {
|
||||
operand.mutableRange.end = phi.id.mutableRange.end;
|
||||
}
|
||||
}
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
// Otherwise this is a temporary phi (logical or ternary) or occurs in a loop. In either
|
||||
// case we can't independently memoize any of the values: unify their ranges to span the
|
||||
|
||||
Reference in New Issue
Block a user