mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Fixes https://github.com/facebook/react-forget/pull/858#discussion_r1044626137. The case is ```javascript function foo() { let x$1 = 1; let y = 2; if (y === 2) { x$2 = 3; } x$3 = phi(x$1, x$2) if (y === 3) { x4 = 5; } x$5 = phi(x$3, x$4); y = x$5; } ``` What happens here is that there are two _sequential_ phis for `x`. Previously when we encountered the second phi we would find that there is no `let` declaration for the phi or any of its operands, and create a new one before the second `if`. That's incorrect, these should all merge into a single `x` declaration. We now look up the phi operands to see if they are part of a previous phi, and merge them correctly.