Joe Savona 59cd1ca569 LeaveSSA: consistently rename identifiers even for value block phis
This PR clarifies the logic for adjust mutable ranges of phis and their operands 
during LeaveSSA. Previously we had logic in several places to determine 
whether/how to extend the ranges of each phi and its operands: this occurred 
while traversing reassignmentPhis (in 2+ places) and rewritePhis, as well as in 
rewritePlace(). 

This was kind of a band-aid to make things work, but the logic was imprecise. 
The actual rules are as follows: 

If there is a back-edge, or the phi id is unnamed, then were extend the ranges 
of the phi and its operands to min(starts) and max(ends). This ensures that the 
operands are computed as one unit, ie put into a single reactive scope. For 
loops this is necessary because...looping! For unnamed values this is necessary 
because of the way we collapse logical and ternary expressions back to a 
hierarchical ReactiveFunction — we need to make sure the final mutable range 
extends from the start of the final instruction up to the end of the 
logical/ternaries value blocks. 

Otherwise this is a phi where operands come from predecessors and are named. If 
the phi is mutated later, then we have to extend the end of each operand's range 
to account for the fact that they can be mutated later. Else, we leave the 
operands alone. 

Behavior doesn't change, but we consolidate all of the mutable range logic in 
one place.
2023-03-14 15:24:38 -07:00
S
Description
No description provided
MIT 1.8 GiB
Languages
JavaScript 67.1%
TypeScript 29.4%
HTML 1.5%
CSS 1.1%
C++ 0.6%
Other 0.2%