summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenObjC
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@apple.com>2019-06-14 22:06:28 +0000
committerAkira Hatanaka <ahatanaka@apple.com>2019-06-14 22:06:28 +0000
commit6cb2d9dbd2d46ee1811f756d4b1f567b8ff36aa9 (patch)
treead9a46f1a38ce64d675f990cccee3f3ffceb15ec /clang/test/CodeGenObjC
parent05e48cb9fabe58b2704fbca14530c844a9d2243d (diff)
downloadbcm5719-llvm-6cb2d9dbd2d46ee1811f756d4b1f567b8ff36aa9.tar.gz
bcm5719-llvm-6cb2d9dbd2d46ee1811f756d4b1f567b8ff36aa9.zip
[CodeGen][ObjC] Annotate retain-agnostic ObjC globals with attribute
'objc_arc_inert' The attribute enables the ARC optimizer to delete ObjC ARC runtime calls on the annotated globals (see https://reviews.llvm.org/D62433). We currently only annotate global variables for string literals and global blocks with the attribute. rdar://problem/49839633 Differential Revision: https://reviews.llvm.org/D62831 llvm-svn: 363467
Diffstat (limited to 'clang/test/CodeGenObjC')
-rw-r--r--clang/test/CodeGenObjC/attr-objc-arc-inert.m16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/test/CodeGenObjC/attr-objc-arc-inert.m b/clang/test/CodeGenObjC/attr-objc-arc-inert.m
new file mode 100644
index 00000000000..eddccf54acd
--- /dev/null
+++ b/clang/test/CodeGenObjC/attr-objc-arc-inert.m
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fblocks -emit-llvm -o - %s | FileCheck %s
+
+// CHECK: @{{.*}} = private global %{{.*}} { i32* getelementptr inbounds ([0 x i32], [0 x i32]* @__CFConstantStringClassReference, i32 0, i32 0), i32 1992, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @{{.*}}, i32 0, i32 0), i64 3 }, section "__DATA,__cfstring", align 8 #[[ATTRNUM0:[0-9]+]]
+// CHECK: @{{.*}} = internal constant { i8**, i32, i32, i8*, %{{.*}}* } { i8** @_NSConcreteGlobalBlock, i32 1342177280, i32 0, i8* bitcast (i32 (i8*)* @{{.*}} to i8*), %{{.*}}* bitcast ({ i64, i64, i8*, i8* }* @{{.*}} to %{{.*}}*) }, align 8 #[[ATTRNUM0]]
+
+@class NSString;
+
+NSString *testStringLiteral(void) {
+ return @"abc";
+}
+
+int testGlobalBlock(int a) {
+ return ^{ return 123; }();
+}
+
+// CHECK: attributes #[[ATTRNUM0]] = { "objc_arc_inert" }
OpenPOWER on IntegriCloud