This patch makes IRGen emit ObjC runtime functions (objc_autoreleaseReturnValue and objc_retainAutoreleasedReturnValue) that were previously emitted only in ARC mode. This enables retain message sends in MRR code to participate in the retainRV/autoreleaseRV handshake, which keeps returned objects out of the autorelease pool. Also, it enables the ARC optimizer and ARC contract pass to remove retain/autorelease pairs and mark autorelease message sends converted to autoreleaseRV calls as tail calls, which is necessary for the retainRV/autoreleaseRV handshake to succeed.
rdar://problem/50353574
I know I suggested this name, but it should probably be -fno-objc-.... instead of -fobjc-no-.....
Please add help text. Also, there probably ought to be a subsection in the user docs under "Objective-C Features" which talks about message rewriting; it should start by discussing the general fact that we rewrite messages, including how to disable it with -fno-objc-convert-messages-to-runtime-calls, and then segue into the special assumptions for retain/release/autorelease and how to disable them with this option.
Should this be implied by -fno-objc-convert-messages-to-runtime-calls?