Commits

Xin Tong committed b69706734d2
Implement @owned to @unowned retain value conversion. If a value is returned as @owned, we can move the epilogue retain to the caller and convert the return value to @unowned. This gives ARC optimizer more freedom to optimize the retain out on the caller's side. It appears that epilgue retains are harder to find than epilogue releases. Most of the time they are not in the return block. (1) Sometimes, they are in predecessors (2) Sometimes they come from a call which returns an @owned return value. This should be improved if we fix (1) and go bottom up. (3) We do not handle exploded retain_value. Currently, this catches a small number of opportunities. We probably need to improve epilogue retain matcher if we are to handle more cases. This is part of rdar://24022375. We also need some refactoring in the pass. e.g. break functions into smaller functions. I will do with subsequent commit.