[ObjC][ARC] Upgrade calls to ARC runtime functions to intrinsic calls if

the bitcode has the arm64 retainAutoreleasedReturnValue marker

The ARC middle-end passes stopped optimizing or transforming bitcode
that has been compiled with old compilers after we started emitting
calls to ARC runtime functions as intrinsic calls instead of normal
function calls in the front-end and made changes to teach the ARC
middle-end passes about those intrinsics (see r349534). This patch
converts calls to ARC runtime functions that are not intrinsic functions
to intrinsic function calls if the bitcode has the arm64
retainAutoreleasedReturnValue marker. Checking for the presence of the
marker is necessary to make sure we aren't changing ARC function calls
that were originally MRR message sends (see r349952).

rdar://problem/53280660

Differential Revision: https://reviews.llvm.org/D65902

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368311 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Akira Hatanaka
2019-08-08 16:59:31 +00:00
parent 66d11c88dc
commit 0d8b491b7e
7 changed files with 150 additions and 16 deletions

View File

@@ -5313,6 +5313,7 @@ Error BitcodeReader::materializeModule() {
UpgradeModuleFlags(*TheModule);
UpgradeRetainReleaseMarker(*TheModule);
UpgradeARCRuntimeCalls(*TheModule);
return Error::success();
}