The only entries in ExprToLoc that will be read by a different block are the direct children of the block terminator (if one exists). For the purposes of determining whether ExprToLoc has converged, it is therefore sufficient to look at these entries, as any differences in other entries will not be seen by other blocks.
The other entries in ExprToLoc are only read during processing of the block that contains the corresponding expressions. To be clear, these entries can affect the results of the block, but only indirectly, in one of two ways:
- If they are indirect descendants of the terminator and therefore affect the values of the terminator's direct children.
- If they affect the entries in one of the other mappings in Environment.
Before this patch, we were comparing all entries in ExprToLoc, even if they were never accessed by other blocks, which could cause non-convergence. This patch adds two tests that demonstrate this; they do not converge without the other changes in this patch.