Commits

Michael Gottesman committed 9ce1cdc7984
[loop-arc] Add support for non-local Loop Successors. Ignoring regions, define a non-local successor of a basic block BB as a successor of BB that is not in the same parent loop. In terms of the current SIL loop analysis a non-local successor is referred to as an "exit block" and BB as an "exiting block". To transform that statement into the world of regions, we say that a non-local successor of a region R is a region S that when we are constructing the parent region of R (which we will call P(R)) has the property that P(S) != P(R). (This is using the construction algorithm of the loop region data structure to define it, one could also create analogous definitions per block and loop, but I am going to leave that to an in commit comment). The main issue with non-local successors is that if we were to represent them directly we would break the invariant that regions only have edges that point at regions in side the same parent region* or at the parent region itself. In order to get around this issue, we break each of the non-local successor edges into smaller non-local successor edges that point up from a region to its parent. Then given the region, one can climb up non-local successor edges into parent regions until one finds the real non-local successor which the final top level parent region will have as a local successor. This is important in order to be able to handle trap basic blocks in the ARC optimizer and early exits more generally. * Consider an early exit from an inner loop. The early exit block will be a successor of the outer loop. The basic block in the inner loop will then have the early exit block as a non-local successor. rdar://22238658 Swift SVN r32695