summaryrefslogtreecommitdiff
path: root/test/CodeGenObjCXX
diff options
context:
space:
mode:
authorArnaud A. de Grandmaison <arnaud.degrandmaison@arm.com>2015-04-10 10:13:52 +0000
committerArnaud A. de Grandmaison <arnaud.degrandmaison@arm.com>2015-04-10 10:13:52 +0000
commit914d1bd47f6252559e110929949d69a7a145881d (patch)
treeee6f946529a950f82dcac4c80668d4e360366db7 /test/CodeGenObjCXX
parent0c6a04ea7e5f057f6a98d5198ce12840f8508c99 (diff)
downloadclang-914d1bd47f6252559e110929949d69a7a145881d.tar.gz
Remove threshold for inserting lifetime markers for named temporaries
Now that TailRecursionElimination has been fixed with r222354, the threshold on size for lifetime marker insertion can be removed. This only affects named temporary though, as the patch for unnamed temporaries is still in progress. My previous commit (r222993) was not handling debuginfo correctly, but this could only be seen with some asan tests. Basically, lifetime markers are just instrumentation for the compiler's usage and should not affect debug information; however, the cleanup infrastructure was assuming it contained only destructors, i.e. actual code to be executed, and was setting the breakpoint for the end of the function to the closing '}', and not the return statement, in order to show some destructors have been called when leaving the function. This is wrong when the cleanups are only lifetime markers, and this is now fixed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234581 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenObjCXX')
-rw-r--r--test/CodeGenObjCXX/arc-move.mm10
-rw-r--r--test/CodeGenObjCXX/arc-references.mm8
-rw-r--r--test/CodeGenObjCXX/arc.mm27
-rw-r--r--test/CodeGenObjCXX/literals.mm10
4 files changed, 55 insertions, 0 deletions
diff --git a/test/CodeGenObjCXX/arc-move.mm b/test/CodeGenObjCXX/arc-move.mm
index dc670492f1..76fb15b290 100644
--- a/test/CodeGenObjCXX/arc-move.mm
+++ b/test/CodeGenObjCXX/arc-move.mm
@@ -46,6 +46,10 @@ void library_move(__strong id &x, __strong id &y) {
// CHECK-LABEL: define void @_Z12library_moveRU8__strongP11objc_object
void library_move(__strong id &y) {
+ // CHECK: [[X:%.*]] = alloca i8*, align 8
+ // CHECK: [[I:%.*]] = alloca i32, align 4
+ // CHECK: [[XPTR1:%.*]] = bitcast i8** [[X]] to i8*
+ // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[XPTR1]])
// CHECK: [[Y:%[a-zA-Z0-9]+]] = call dereferenceable({{[0-9]+}}) i8** @_Z4moveIRU8__strongP11objc_objectEON16remove_referenceIT_E4typeEOS5_
// Load the object
// CHECK-NEXT: [[OBJ:%[a-zA-Z0-9]+]] = load i8*, i8** [[Y]]
@@ -55,10 +59,16 @@ void library_move(__strong id &y) {
// CHECK-NEXT: store i8* [[OBJ]], i8** [[X:%[a-zA-Z0-9]+]]
id x = move(y);
+ // CHECK-NEXT: [[IPTR1:%.*]] = bitcast i32* [[I]] to i8*
+ // CHECK-NEXT: call void @llvm.lifetime.start(i64 4, i8* [[IPTR1]])
// CHECK-NEXT: store i32 17
int i = 17;
+ // CHECK-NEXT: [[IPTR2:%.*]] = bitcast i32* [[I]] to i8*
+ // CHECK-NEXT: call void @llvm.lifetime.end(i64 4, i8* [[IPTR2]])
// CHECK-NEXT: [[OBJ:%[a-zA-Z0-9]+]] = load i8*, i8** [[X]]
// CHECK-NEXT: call void @objc_release(i8* [[OBJ]])
+ // CHECK-NEXT: [[XPTR2:%.*]] = bitcast i8** [[X]] to i8*
+ // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[XPTR2]])
// CHECK-NEXT: ret void
}
diff --git a/test/CodeGenObjCXX/arc-references.mm b/test/CodeGenObjCXX/arc-references.mm
index 2bd21c31b4..8397abeb67 100644
--- a/test/CodeGenObjCXX/arc-references.mm
+++ b/test/CodeGenObjCXX/arc-references.mm
@@ -38,11 +38,14 @@ typedef __strong id strong_id;
//CHECK: define void @_Z5test3v
void test3() {
+ // CHECK: [[REF:%.*]] = alloca i8**, align 8
// CHECK: call i8* @objc_initWeak
// CHECK-NEXT: store i8**
const __weak id &ref = strong_id();
// CHECK-NEXT: call void @_Z6calleev()
callee();
+ // CHECK-NEXT: [[PTR:%.*]] = bitcast i8*** [[REF]] to i8*
+ // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[PTR]])
// CHECK-NEXT: call void @objc_destroyWeak
// CHECK-NEXT: ret void
}
@@ -62,6 +65,7 @@ void sink(__strong A* &&);
// CHECK-LABEL: define void @_Z5test5RU8__strongP11objc_object
void test5(__strong id &x) {
// CHECK: [[REFTMP:%.*]] = alloca {{%.*}}*, align 8
+ // CHECK: [[I:%.*]] = alloca i32, align 4
// CHECK: [[OBJ_ID:%.*]] = call i8* @objc_retain(
// CHECK-NEXT: [[OBJ_A:%.*]] = bitcast i8* [[OBJ_ID]] to [[A:%[a-zA-Z0-9]+]]*
// CHECK-NEXT: store [[A]]* [[OBJ_A]], [[A]]** [[REFTMP:%[a-zA-Z0-9]+]]
@@ -70,8 +74,12 @@ void test5(__strong id &x) {
// CHECK-NEXT: [[OBJ_A:%[a-zA-Z0-9]+]] = load [[A]]*, [[A]]** [[REFTMP]]
// CHECK-NEXT: [[OBJ_ID:%[a-zA-Z0-9]+]] = bitcast [[A]]* [[OBJ_A]] to i8*
// CHECK-NEXT: call void @objc_release
+ // CHECK-NEXT: [[IPTR1:%.*]] = bitcast i32* [[I]] to i8*
+ // CHECK-NEXT: call void @llvm.lifetime.start(i64 4, i8* [[IPTR1]])
// CHECK-NEXT: store i32 17, i32
int i = 17;
+ // CHECK-NEXT: [[IPTR2:%.*]] = bitcast i32* [[I]] to i8*
+ // CHECK-NEXT: call void @llvm.lifetime.end(i64 4, i8* [[IPTR2]])
// CHECK-NEXT: ret void
}
diff --git a/test/CodeGenObjCXX/arc.mm b/test/CodeGenObjCXX/arc.mm
index c66417ba24..a8b47002e7 100644
--- a/test/CodeGenObjCXX/arc.mm
+++ b/test/CodeGenObjCXX/arc.mm
@@ -64,7 +64,11 @@ void test34(int cond) {
// CHECK-NEXT: [[CONDCLEANUPSAVE:%.*]] = alloca i8*
// CHECK-NEXT: [[CONDCLEANUP:%.*]] = alloca i1
// CHECK-NEXT: store i32
+ // CHECK-NEXT: [[STRONGP:%.*]] = bitcast i8** [[STRONG]] to i8*
+ // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[STRONGP]])
// CHECK-NEXT: store i8* null, i8** [[STRONG]]
+ // CHECK-NEXT: [[WEAKP:%.*]] = bitcast i8** [[WEAK]] to i8*
+ // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[WEAKP]])
// CHECK-NEXT: call i8* @objc_initWeak(i8** [[WEAK]], i8* null)
// CHECK-NEXT: [[T0:%.*]] = load i32, i32* [[COND]]
@@ -120,56 +124,77 @@ struct Test35_Helper {
// CHECK-LABEL: define void @_Z6test3513Test35_HelperPS_
void test35(Test35_Helper x0, Test35_Helper *x0p) {
+ // CHECK: call void @llvm.lifetime.start
// CHECK: call i8* @_ZN13Test35_Helper11makeObject1Ev
// CHECK-NOT: call i8* @objc_retain
id obj1 = Test35_Helper::makeObject1();
+ // CHECK: call void @llvm.lifetime.start
// CHECK: call i8* @_ZN13Test35_Helper11makeObject2Ev
// CHECK-NOT: call i8* @objc_retain
id obj2 = x0.makeObject2();
+ // CHECK: call void @llvm.lifetime.start
// CHECK: call i8* @_ZN13Test35_Helper11makeObject2Ev
// CHECK-NOT: call i8* @objc_retain
id obj3 = x0p->makeObject2();
id (Test35_Helper::*pmf)() __attribute__((ns_returns_retained))
= &Test35_Helper::makeObject2;
+ // CHECK: call void @llvm.lifetime.start
// CHECK: call i8* %
// CHECK-NOT: call i8* @objc_retain
id obj4 = (x0.*pmf)();
+ // CHECK: call void @llvm.lifetime.start
// CHECK: call i8* %
// CHECK-NOT: call i8* @objc_retain
id obj5 = (x0p->*pmf)();
// CHECK: call void @objc_release
+ // CHECK: call void @llvm.lifetime.end
// CHECK: call void @objc_release
+ // CHECK: call void @llvm.lifetime.end
// CHECK: call void @objc_release
+ // CHECK: call void @llvm.lifetime.end
// CHECK: call void @objc_release
+ // CHECK: call void @llvm.lifetime.end
// CHECK: call void @objc_release
+ // CHECK: call void @llvm.lifetime.end
// CHECK-NEXT: ret void
}
// CHECK-LABEL: define void @_Z7test35b13Test35_HelperPS_
void test35b(Test35_Helper x0, Test35_Helper *x0p) {
+ // CHECK: call void @llvm.lifetime.start
// CHECK: call i8* @_ZN13Test35_Helper11makeObject3Ev
// CHECK: call i8* @objc_retain
id obj1 = Test35_Helper::makeObject3();
+ // CHECK: call void @llvm.lifetime.start
// CHECK: call i8* @_ZN13Test35_Helper11makeObject4Ev
// CHECK: call i8* @objc_retain
id obj2 = x0.makeObject4();
+ // CHECK: call void @llvm.lifetime.start
// CHECK: call i8* @_ZN13Test35_Helper11makeObject4Ev
// CHECK: call i8* @objc_retain
id obj3 = x0p->makeObject4();
id (Test35_Helper::*pmf)() = &Test35_Helper::makeObject4;
+ // CHECK: call void @llvm.lifetime.start
// CHECK: call i8* %
// CHECK: call i8* @objc_retain
id obj4 = (x0.*pmf)();
+ // CHECK: call void @llvm.lifetime.start
// CHECK: call i8* %
// CHECK: call i8* @objc_retain
id obj5 = (x0p->*pmf)();
// CHECK: call void @objc_release
+ // CHECK: call void @llvm.lifetime.end
// CHECK: call void @objc_release
+ // CHECK: call void @llvm.lifetime.end
+ // CHECK: call void @llvm.lifetime.end
// CHECK: call void @objc_release
+ // CHECK: call void @llvm.lifetime.end
// CHECK: call void @objc_release
+ // CHECK: call void @llvm.lifetime.end
// CHECK: call void @objc_release
+ // CHECK: call void @llvm.lifetime.end
// CHECK-NEXT: ret void
}
@@ -290,6 +315,8 @@ template void test40_helper<int>();
// CHECK-LABEL: define weak_odr void @_Z13test40_helperIiEvv()
// CHECK: [[X:%.*]] = alloca i8*
// CHECK-NEXT: [[TEMP:%.*]] = alloca i8*
+// CHECK-NEXT: [[XP:%.*]] = bitcast i8** [[X]] to i8*
+// CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[XP]])
// CHECK-NEXT: store i8* null, i8** [[X]]
// CHECK: [[T0:%.*]] = load i8*, i8** [[X]]
// CHECK-NEXT: store i8* [[T0]], i8** [[TEMP]]
diff --git a/test/CodeGenObjCXX/literals.mm b/test/CodeGenObjCXX/literals.mm
index 722c53d0e8..7089de23b9 100644
--- a/test/CodeGenObjCXX/literals.mm
+++ b/test/CodeGenObjCXX/literals.mm
@@ -16,9 +16,12 @@ struct Y {
// CHECK-LABEL: define void @_Z10test_arrayv
void test_array() {
+ // CHECK: [[ARR:%[a-zA-Z0-9.]+]] = alloca i8*
// CHECK: [[OBJECTS:%[a-zA-Z0-9.]+]] = alloca [2 x i8*]
// Initializing first element
+ // CHECK: [[PTR1:%.*]] = bitcast i8** [[ARR]] to i8*
+ // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[PTR1]])
// CHECK: [[ELEMENT0:%[a-zA-Z0-9.]+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[OBJECTS]], i32 0, i32 0
// CHECK-NEXT: call void @_ZN1XC1Ev
// CHECK-NEXT: [[OBJECT0:%[a-zA-Z0-9.]+]] = invoke i8* @_ZNK1XcvP11objc_objectEv
@@ -47,6 +50,8 @@ void test_array() {
// CHECK-NEXT: call void @_ZN1XD1Ev
// CHECK-NOT: ret void
// CHECK: call void @objc_release
+ // CHECK-NEXT: [[PTR2:%.*]] = bitcast i8** [[ARR]] to i8*
+ // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[PTR2]])
// CHECK-NEXT: ret void
// Check cleanups
@@ -63,9 +68,12 @@ void test_array() {
// CHECK-LABEL: define weak_odr void @_Z24test_array_instantiationIiEvv
template<typename T>
void test_array_instantiation() {
+ // CHECK: [[ARR:%[a-zA-Z0-9.]+]] = alloca i8*
// CHECK: [[OBJECTS:%[a-zA-Z0-9.]+]] = alloca [2 x i8*]
// Initializing first element
+ // CHECK: [[PTR1:%.*]] = bitcast i8** [[ARR]] to i8*
+ // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[PTR1]])
// CHECK: [[ELEMENT0:%[a-zA-Z0-9.]+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[OBJECTS]], i32 0, i32 0
// CHECK-NEXT: call void @_ZN1XC1Ev
// CHECK-NEXT: [[OBJECT0:%[a-zA-Z0-9.]+]] = invoke i8* @_ZNK1XcvP11objc_objectEv
@@ -94,6 +102,8 @@ void test_array_instantiation() {
// CHECK-NEXT: call void @_ZN1XD1Ev
// CHECK-NOT: ret void
// CHECK: call void @objc_release
+ // CHECK-NEXT: [[PTR2]] = bitcast i8** [[ARR]] to i8*
+ // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[PTR2]])
// CHECK-NEXT: ret void
// Check cleanups