From 7a9aac2d9ff5a08c080833aa002b8c3e0f99178c Mon Sep 17 00:00:00 2001 From: John McCall Date: Mon, 23 Aug 2010 01:21:21 +0000 Subject: Abstract out everything having to do with member pointers into the ABI class; they should just be completely opaque throughout IR gen now, although I haven't really audited that. Fix a bug apparently inherited from gcc-4.2 where we failed to null-check member data pointers when performing derived-to-base or base-to-derived conversions on them. llvm-svn: 111789 --- clang/test/CodeGenCXX/member-function-pointers.cpp | 4 ++-- clang/test/CodeGenCXX/pointers-to-data-members.cpp | 16 +++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'clang/test/CodeGenCXX') diff --git a/clang/test/CodeGenCXX/member-function-pointers.cpp b/clang/test/CodeGenCXX/member-function-pointers.cpp index 3e95f39a423..78a571e196e 100644 --- a/clang/test/CodeGenCXX/member-function-pointers.cpp +++ b/clang/test/CodeGenCXX/member-function-pointers.cpp @@ -38,14 +38,14 @@ void f() { // CHECK: [[TMP:%.*]] = load %0* @pa, align 8 // CHECK: [[TMPADJ:%.*]] = extractvalue %0 [[TMP]], 1 - // CHECK: [[ADJ:%.*]] = add i64 [[TMPADJ]], 16 + // CHECK: [[ADJ:%.*]] = add nsw i64 [[TMPADJ]], 16 // CHECK: [[RES:%.*]] = insertvalue %0 [[TMP]], i64 [[ADJ]], 1 // CHECK: store %0 [[RES]], %0* @pc, align 8 pc = pa; // CHECK: [[TMP:%.*]] = load %0* @pc, align 8 // CHECK: [[TMPADJ:%.*]] = extractvalue %0 [[TMP]], 1 - // CHECK: [[ADJ:%.*]] = sub i64 [[TMPADJ]], 16 + // CHECK: [[ADJ:%.*]] = sub nsw i64 [[TMPADJ]], 16 // CHECK: [[RES:%.*]] = insertvalue %0 [[TMP]], i64 [[ADJ]], 1 // CHECK: store %0 [[RES]], %0* @pa, align 8 pa = static_cast(pc); diff --git a/clang/test/CodeGenCXX/pointers-to-data-members.cpp b/clang/test/CodeGenCXX/pointers-to-data-members.cpp index 70308c6abc5..60c1661e060 100644 --- a/clang/test/CodeGenCXX/pointers-to-data-members.cpp +++ b/clang/test/CodeGenCXX/pointers-to-data-members.cpp @@ -65,15 +65,21 @@ int A::*pa; int C::*pc; void f() { - // CHECK: store i64 -1, i64* @_ZN5Casts2paE + // CHECK: store i64 -1, i64* @_ZN5Casts2paE pa = 0; - // CHECK: [[ADJ:%[a-zA-Z0-9\.]+]] = add nsw i64 {{.*}}, 4 - // CHECK: store i64 [[ADJ]], i64* @_ZN5Casts2pcE + // CHECK-NEXT: [[TMP:%.*]] = load i64* @_ZN5Casts2paE, align 8 + // CHECK-NEXT: [[ADJ:%.*]] = add nsw i64 [[TMP]], 4 + // CHECK-NEXT: [[ISNULL:%.*]] = icmp eq i64 [[TMP]], -1 + // CHECK-NEXT: [[RES:%.*]] = select i1 [[ISNULL]], i64 [[TMP]], i64 [[ADJ]] + // CHECK-NEXT: store i64 [[RES]], i64* @_ZN5Casts2pcE pc = pa; - // CHECK: [[ADJ:%[a-zA-Z0-9\.]+]] = sub nsw i64 {{.*}}, 4 - // CHECK: store i64 [[ADJ]], i64* @_ZN5Casts2paE + // CHECK-NEXT: [[TMP:%.*]] = load i64* @_ZN5Casts2pcE, align 8 + // CHECK-NEXT: [[ADJ:%.*]] = sub nsw i64 [[TMP]], 4 + // CHECK-NEXT: [[ISNULL:%.*]] = icmp eq i64 [[TMP]], -1 + // CHECK-NEXT: [[RES:%.*]] = select i1 [[ISNULL]], i64 [[TMP]], i64 [[ADJ]] + // CHECK-NEXT: store i64 [[RES]], i64* @_ZN5Casts2paE pa = static_cast(pc); } -- cgit v1.2.3