Commits

Michael Gottesman committed 9c02b2c6d57
[loop-arc] Instead of using a lambda, use a callback data structure to process ARC results. This is necessary since previously we would: 1. Perform data flow over an entire function. 2. Process all of the gathered data, inserting instructions to be deleted into a list to avoid dangling pointer issues. 3. Delete instructions after processing the data to avoid the dangling pointer issues. 4. If we saw any nested retain/releases and deleted any instructions, run ARC again on the entire function. For loop arc, we want to: 1. Visit the loop nest in post order. 2. For each loop: a. Perform data flow over the loop. b. Process all of the gathered data, inserting instructions to be deleted into a list to avoid dangling pointer issues. c. Delete instructions after loop processing has finished and potentially summarize the loop. d. If we saw any nested retain/releases and deleted any instructions, run ARC again on the loop. This is more efficient in terms of the number of times that we perform dataflow and allows us to summarize as we go. The main disadvantage is that Block ARC steps (3,4) could occur in GlobalARCOpts.cpp. Loop ARC on the other hand needs (2.c.) and (2.d.) to occur while processing. This means I need a real callback context and an extra callback call to say when it is ok for a user of the analysis to remove instructions. rdar://22238658 * The dangling pointer issue is that a retain/release could act as a last use/first decrement for a different retain/release. If process the different retain/release later, we will be touching a dangling pointer. Swift SVN r32867