[clang/objc] Optimize getters for non-atomic, copied properties
authorDave MacLachlan <dmaclach@google.com>
Tue, 13 Jul 2021 13:21:25 +0000 (09:21 -0400)
committerNico Weber <thakis@chromium.org>
Tue, 13 Jul 2021 13:22:13 +0000 (09:22 -0400)
commit45ffe6341d9642487785b0d0028166e6fbdbe5d7
treefbc31794ec2e5d6975842d1aa01aabf5fa5c4cb2
parentc99e17fef5f34ac536192fa7b915641f1962c7b9
[clang/objc] Optimize getters for non-atomic, copied properties

Properties that were declared `@property(copy, nonatomic) id foo` make an
unnecessary call to objc_get_property().  This call can be replaced with a
direct access to the backing variable identical to how a `@property(nonatomic)
id foo` would do it.

This reduces codegen by 4 bytes (x86_64/arm64) and removes a cross linkage unit
function call per property declared as copy/nonatomic.

Differential Revision: https://reviews.llvm.org/D105311
clang/lib/CodeGen/CGObjC.cpp
clang/test/CodeGenObjC/arc-blocks.m