swift
191f9db5 - EscapeAnalysis: eliminate dangling pointers.

Commit
6 years ago
EscapeAnalysis: eliminate dangling pointers. Avoid dangling pointers in the connection graph when SILValues are deleted. This didn't show up in normal compilation because the values were only used for printing the graph. But now we have more assertions that check for well-formed graph. These could hit the dangling pointers. To guarantee this can't happen, establish a strict invariant that the mappedValue is only used for nodes that exist in the value-to-node map. Then clear out mappedValue whenever a value is deleted. Add verification to ensure that each node's mappedValue is valid and catch dangling pointers quickly. This completely changes the way that a node values are set and used which in turn makes it *much* easier to debug the graph and associate the nodes with the SIL function. For example, it's normal to view or dump the graph at a key point. When the nodes are printed, the associated SILValues are now more precise and consistent. However, it's also normal to call CGNode::dump() from tracing code or within a debugger. Previously, there was no way to assocate the output of CGNode::dump() with the printed or displayed connection graph. Now both forms of output have identical node IDs! While we're at it, make sure the hasRC flag is always merged conservatively in a couple more places. Fixed <rdar://57290845> While running SILFunctionTransform "TempRValueOpt"
Author
Committer
Parents
Loading