Commits

John McCall committed 23ea72b21e4
Teach IRGen to apply the ARC autorelease optimization implicitly when working with autoreleased result conventions, and stop emitting autorelease_return and strong_retain_autoreleased in SILGen. The previous representation, in which strong_retain_autoreleased was divorced from the call site, allowed it to "wander off" and be cloned. This would at best would break the optimization, but it could also lead to broken IR due to some heroic but perhaps misguided efforts in IRGen to produce the exact required code pattern despite the representational flaws. The SIL pattern for an autoreleased result now looks exactly like the pattern for an owned result in both the caller and the callee. This should be fine as long as interprocedural optimizations are conservative about convention mismatches. Optimizations that don't wish to be conservative here should treat a convention mismatch as an autorelease (if the callee has an autoreleased result) or a retain (if the formal type of the call has an autoreleased result). Fixes rdar://23810212, which is an IRGen miscompile after the optimizer cloned a strong_retain_autoreleased. There's no point in adding this test case because the new SIL pattern inherently prevents this transformation by construction. The 'autorelease_return' and 'strong_retain_autoreleased' instructions are now dead, and I will remove them in a follow-up commit.