diff options
author | John McCall <rjmccall@apple.com> | 2011-05-14 21:12:11 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-05-14 21:12:11 +0000 |
commit | 5880fb8edfa364555fc66d952f283d014c64fccb (patch) | |
tree | e365e55c5d4d26d5787e121bafb540ed06833887 /clang/test/CodeGenObjC/messages-2.m | |
parent | dd72aafffc897e565c1ffc6d17009a05f52c995b (diff) | |
download | bcm5719-llvm-5880fb8edfa364555fc66d952f283d014c64fccb.tar.gz bcm5719-llvm-5880fb8edfa364555fc66d952f283d014c64fccb.zip |
Only perform the null-initialization of an aggregate result of a message
send if the receiver is null. Normally it's not worthwhile to check this,
but avoiding the null-initialization is nice, and this also avoids nasty
problems where the null-initialization is visible within the call because
we use an aliased result buffer. rdar://problem/9402992
llvm-svn: 131366
Diffstat (limited to 'clang/test/CodeGenObjC/messages-2.m')
-rw-r--r-- | clang/test/CodeGenObjC/messages-2.m | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/clang/test/CodeGenObjC/messages-2.m b/clang/test/CodeGenObjC/messages-2.m index 5ef2261b198..e4e8cfb5e20 100644 --- a/clang/test/CodeGenObjC/messages-2.m +++ b/clang/test/CodeGenObjC/messages-2.m @@ -147,17 +147,29 @@ typedef struct { // rdar://problem/7854674 // CHECK: define void @test0([[A:%.*]]* // CHECK-NF: define void @test0([[A:%.*]]* -void test0(A *a) { - // CHECK: alloca [[A]]* +void test0(A *x) { + // CHECK: [[X:%.*]] = alloca [[A]]* // CHECK-NEXT: [[POINT:%.*]] = alloca [[POINT_T:%.*]], - // CHECK-NF: alloca [[A]]* - // CHECK-NF-NEXT: [[POINT:%.*]] = alloca [[POINT_T:%.*]], - + // CHECK: [[T0:%.*]] = load [[A]]** [[X]] + // CHECK: [[T1:%.*]] = bitcast [[A]]* [[T0]] to i8* + // CHECK-NEXT: icmp eq i8* [[T1]], null + // CHECK-NEXT: br i1 + // CHECK: call {{.*}} @objc_msgSend_stret to + // CHECK-NEXT: br label // CHECK: [[T0:%.*]] = bitcast [[POINT_T]]* [[POINT]] to i8* // CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[T0]], i8 0, i64 48, i32 4, i1 false) - // CHECK-NEXT: call {{.*}} @objc_msgSend_stret to + // CHECK-NEXT: br label + + // CHECK-NF: [[X:%.*]] = alloca [[A]]* + // CHECK-NF-NEXT: [[POINT:%.*]] = alloca [[POINT_T:%.*]], + // CHECK-NF: [[T0:%.*]] = load [[A]]** [[X]] + // CHECK-NF: [[T1:%.*]] = bitcast [[A]]* [[T0]] to i8* + // CHECK-NF-NEXT: icmp eq i8* [[T1]], null + // CHECK-NF-NEXT: br i1 + // CHECK-NF: call {{.*}} @objc_msgSend_stret to + // CHECK-NF-NEXT: br label // CHECK-NF: [[T0:%.*]] = bitcast [[POINT_T]]* [[POINT]] to i8* // CHECK-NF-NEXT: call void @llvm.memset.p0i8.i64(i8* [[T0]], i8 0, i64 48, i32 4, i1 false) - // CHECK-NF-NEXT: call {{.*}} @objc_msgSend_stret to - MyPoint point = [a returnAPoint]; + // CHECK-NF-NEXT: br label + MyPoint point = [x returnAPoint]; } |