[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:
Sathya Gunasekaran
2023-10-24 16:09:08 +01:00
parent 3571dfa056
commit 3d3ad1b9ef
@@ -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