diff options
author | Anders Carlsson <andersca@mac.com> | 2010-05-03 16:05:06 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-05-03 16:05:06 +0000 |
commit | 32897fd3bd84e96d4bfa28aca0c7a907776fb855 (patch) | |
tree | 66bd64353837e62f5b094b060c03bc681358333e /test/CodeGenCXX/member-function-pointers.cpp | |
parent | 7362258bb8c84cc3107993a7249cb3602ceb0bb7 (diff) |
When computing the address of a virtual member function pointer, use the pointer width instead of hardcoding for 64-bit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102921 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/member-function-pointers.cpp')
-rw-r--r-- | test/CodeGenCXX/member-function-pointers.cpp | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/test/CodeGenCXX/member-function-pointers.cpp b/test/CodeGenCXX/member-function-pointers.cpp index f7c445b1cb..a1f4daec8e 100644 --- a/test/CodeGenCXX/member-function-pointers.cpp +++ b/test/CodeGenCXX/member-function-pointers.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-apple-darwin9 | FileCheck %s +// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i386-apple-darwin9 | FileCheck -check-prefix LP32 %s struct A { int a; void f(); virtual void vf1(); virtual void vf2(); }; struct B { int b; virtual void g(); }; @@ -12,10 +13,12 @@ void (C::*pc)(); // CHECK: @pa2 = global %0 { i64 ptrtoint (void (%struct.A*)* @_ZN1A1fEv to i64), i64 0 }, align 8 void (A::*pa2)() = &A::f; -// CHECK: @pa3 = global %0 { i64 1, i64 0 }, align 8 +// CHECK: @pa3 = global %0 { i64 1, i64 0 }, align 8 +// CHECK-LP32: @pa3 = global %0 { i32 1, i32 0 }, align 4 void (A::*pa3)() = &A::vf1; -// CHECK: @pa4 = global %0 { i64 9, i64 0 }, align 8 +// CHECK: @pa4 = global %0 { i64 9, i64 0 }, align 8 +// CHECK-LP32: @pa4 = global %0 { i32 5, i32 0 }, align 4 void (A::*pa4)() = &A::vf2; // CHECK: @pc2 = global %0 { i64 ptrtoint (void (%struct.A*)* @_ZN1A1fEv to i64), i64 16 }, align 8 @@ -51,16 +54,24 @@ void f2() { // CHECK: store i64 0, i64* [[pa2adj]] void (A::*pa2)() = &A::f; - // CHECK: [[pa3ptr:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa3, i32 0, i32 0 - // CHECK: store i64 1, i64* [[pa3ptr]] - // CHECK: [[pa3adj:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa3, i32 0, i32 1 - // CHECK: store i64 0, i64* [[pa3adj]] + // CHECK: [[pa3ptr:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa3, i32 0, i32 0 + // CHECK: store i64 1, i64* [[pa3ptr]] + // CHECK: [[pa3adj:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa3, i32 0, i32 1 + // CHECK: store i64 0, i64* [[pa3adj]] + // CHECK-LP32: [[pa3ptr:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa3, i32 0, i32 0 + // CHECK-LP32: store i32 1, i32* [[pa3ptr]] + // CHECK-LP32: [[pa3adj:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa3, i32 0, i32 1 + // CHECK-LP32: store i32 0, i32* [[pa3adj]] void (A::*pa3)() = &A::vf1; - // CHECK: [[pa4ptr:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa4, i32 0, i32 0 - // CHECK: store i64 9, i64* [[pa4ptr]] - // CHECK: [[pa4adj:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa4, i32 0, i32 1 - // CHECK: store i64 0, i64* [[pa4adj]] + // CHECK: [[pa4ptr:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa4, i32 0, i32 0 + // CHECK: store i64 9, i64* [[pa4ptr]] + // CHECK: [[pa4adj:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa4, i32 0, i32 1 + // CHECK: store i64 0, i64* [[pa4adj]] + // CHECK-LP32: [[pa4ptr:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa4, i32 0, i32 0 + // CHECK-LP32: store i32 5, i32* [[pa4ptr]] + // CHECK-LP32: [[pa4adj:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa4, i32 0, i32 1 + // CHECK-LP32: store i32 0, i32* [[pa4adj]] void (A::*pa4)() = &A::vf2; } |