summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenObjC/mrc-weak.m
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@apple.com>2018-08-10 15:09:24 +0000
committerAkira Hatanaka <ahatanaka@apple.com>2018-08-10 15:09:24 +0000
commit9978da3615f9d29d1f59858a0d53fedb70570095 (patch)
tree395a03bcdc2bb84c41514d34476a62c8c5218537 /clang/test/CodeGenObjC/mrc-weak.m
parent70fcafc09644c8f9ea39edebe5fa2c63a47b6ee4 (diff)
downloadbcm5719-llvm-9978da3615f9d29d1f59858a0d53fedb70570095.tar.gz
bcm5719-llvm-9978da3615f9d29d1f59858a0d53fedb70570095.zip
[CodeGen] Merge equivalent block copy/helper functions.
Clang generates copy and dispose helper functions for each block literal on the stack. Often these functions are equivalent for different blocks. This commit makes changes to merge equivalent copy and dispose helper functions and reduce code size. To enable merging equivalent copy/dispose functions, the captured object infomation is encoded into the helper function name. This allows IRGen to check whether an equivalent helper function has already been emitted and reuse the function instead of generating a new helper function whenever a block is defined. In addition, the helper functions are marked as linkonce_odr to enable merging helper functions that have the same name across translation units and marked as unnamed_addr to enable the linker's deduplication pass to merge functions that have different names but the same content. rdar://problem/42640608 Differential Revision: https://reviews.llvm.org/D50152 llvm-svn: 339438
Diffstat (limited to 'clang/test/CodeGenObjC/mrc-weak.m')
-rw-r--r--clang/test/CodeGenObjC/mrc-weak.m16
1 files changed, 8 insertions, 8 deletions
diff --git a/clang/test/CodeGenObjC/mrc-weak.m b/clang/test/CodeGenObjC/mrc-weak.m
index e2c78f07336..f77b9456177 100644
--- a/clang/test/CodeGenObjC/mrc-weak.m
+++ b/clang/test/CodeGenObjC/mrc-weak.m
@@ -139,10 +139,10 @@ void test7(void) {
// CHECK: call void @use_block
// CHECK: call void @objc_destroyWeak
-// CHECK-LABEL: define internal void @__copy_helper_block
+// CHECK-LABEL: define linkonce_odr hidden void @__copy_helper_block
// CHECK: @objc_copyWeak
-// CHECK-LABEL: define internal void @__destroy_helper_block
+// CHECK-LABEL: define linkonce_odr hidden void @__destroy_helper_block
// CHECK: @objc_destroyWeak
void test8(void) {
@@ -162,16 +162,16 @@ void test8(void) {
// CHECK: call void @objc_destroyWeak
// CHECK-LABEL: define void @test9_baseline()
-// CHECK: define internal void @__copy_helper
-// CHECK: define internal void @__destroy_helper
+// CHECK: define linkonce_odr hidden void @__copy_helper
+// CHECK: define linkonce_odr hidden void @__destroy_helper
void test9_baseline(void) {
Foo *p = get_object();
use_block(^{ [p run]; });
}
// CHECK-LABEL: define void @test9()
-// CHECK-NOT: define internal void @__copy_helper
-// CHECK-NOT: define internal void @__destroy_helper
+// CHECK-NOT: define linkonce_odr hidden void @__copy_helper
+// CHECK-NOT: define linkonce_odr hidden void @__destroy_helper
// CHECK: define void @test9_fin()
void test9(void) {
__unsafe_unretained Foo *p = get_object();
@@ -180,8 +180,8 @@ void test9(void) {
void test9_fin() {}
// CHECK-LABEL: define void @test10()
-// CHECK-NOT: define internal void @__copy_helper
-// CHECK-NOT: define internal void @__destroy_helper
+// CHECK-NOT: define linkonce_odr hidden void @__copy_helper
+// CHECK-NOT: define linkonce_odr hidden void @__destroy_helper
// CHECK: define void @test10_fin()
void test10(void) {
typedef __unsafe_unretained Foo *UnsafeFooPtr;
OpenPOWER on IntegriCloud