Commits

Michael Gottesman committed 8e9bc84677d
Perform the RRN optimization early/clear when we see an unknown call. If we have an unknown call, we need to create any retainN calls we have seen. The reason why is that we do not want to move retains, releases over isUniquelyReferenced calls. Specifically imagine this: retain(x); unknown(x); release(x); isUniquelyReferenced(x); retain(x); In this case we would with this optimization merge the last retain with the first. This would then create an additional copy. The release side of this is: retain(x); unknown(x); release(x); isUniquelyReferenced(x); release(x); Again in such a case by merging the first release with the second release, we would be introducing an additional copy. Thus if we see an unknown call we merge together all retains and releases before to get some optimization without any loss of correctness. This could be made more aggressive through appropriate alias analysis and usage of LLVM's function attributes to determine that a function does not touch globals. Swift SVN r30394