diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2016-03-14 19:07:10 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2016-03-14 19:07:10 +0000 |
commit | a237fa06fdfa4db7170f4858bd956583cde9b888 (patch) | |
tree | 5a4006a7deea0aa457688c50c7a56ed843367065 /test/CodeGenCXX/vtable-assume-load.cpp | |
parent | 6968928bfded15e0221a115052e3b47daa8aaf68 (diff) |
CodeGen: Use 32-bit gep offsets to address vtable address points.
The relative vtable ABI will use a struct rather than an array as the type
of a vtable. LLVM only allows 32-bit integers as struct indices, so we need
to use 32-bit integers to get addresses of address points. In order to keep
the code simple, we might as well do that unconditionally.
It's probably a reasonable implementation limit to support no more than 2
billion virtual functions per class.
This change causes quite a bit of churn in the test suite, so I'm making
it separately.
Differential Revision: http://reviews.llvm.org/D18113
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263469 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/vtable-assume-load.cpp')
-rw-r--r-- | test/CodeGenCXX/vtable-assume-load.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/test/CodeGenCXX/vtable-assume-load.cpp b/test/CodeGenCXX/vtable-assume-load.cpp index 30cfc00ec7..819b09d70e 100644 --- a/test/CodeGenCXX/vtable-assume-load.cpp +++ b/test/CodeGenCXX/vtable-assume-load.cpp @@ -27,7 +27,7 @@ void g(A *a) { a->foo(); } // CHECK1-LABEL: define void @_ZN5test14fooAEv() // CHECK1: call void @_ZN5test11AC1Ev(%"struct.test1::A"* // CHECK1: %[[VTABLE:.*]] = load i8**, i8*** %{{.*}} -// CHECK1: %[[CMP:.*]] = icmp eq i8** %[[VTABLE]], getelementptr inbounds ([3 x i8*], [3 x i8*]* @_ZTVN5test11AE, i64 0, i64 2) +// CHECK1: %[[CMP:.*]] = icmp eq i8** %[[VTABLE]], getelementptr inbounds ([3 x i8*], [3 x i8*]* @_ZTVN5test11AE, i32 0, i32 2) // CHECK1: call void @llvm.assume(i1 %[[CMP]]) // CHECK1-LABEL: } @@ -39,7 +39,7 @@ void fooA() { // CHECK1-LABEL: define void @_ZN5test14fooBEv() // CHECK1: call void @_ZN5test11BC1Ev(%"struct.test1::B"* %{{.*}}) // CHECK1: %[[VTABLE:.*]] = load i8**, i8*** %{{.*}} -// CHECK1: %[[CMP:.*]] = icmp eq i8** %[[VTABLE]], getelementptr inbounds ([3 x i8*], [3 x i8*]* @_ZTVN5test11BE, i64 0, i64 2) +// CHECK1: %[[CMP:.*]] = icmp eq i8** %[[VTABLE]], getelementptr inbounds ([3 x i8*], [3 x i8*]* @_ZTVN5test11BE, i32 0, i32 2) // CHECK1: call void @llvm.assume(i1 %[[CMP]]) // CHECK1-LABEL: } @@ -73,14 +73,14 @@ void h(B *b) { b->bar(); } // CHECK2-LABEL: define void @_ZN5test24testEv() // CHECK2: call void @_ZN5test21CC1Ev(%"struct.test2::C"* // CHECK2: %[[VTABLE:.*]] = load i8**, i8*** {{.*}} -// CHECK2: %[[CMP:.*]] = icmp eq i8** %[[VTABLE]], getelementptr inbounds ([6 x i8*], [6 x i8*]* @_ZTVN5test21CE, i64 0, i64 2) +// CHECK2: %[[CMP:.*]] = icmp eq i8** %[[VTABLE]], getelementptr inbounds ([6 x i8*], [6 x i8*]* @_ZTVN5test21CE, i32 0, i32 2) // CHECK2: call void @llvm.assume(i1 %[[CMP]]) // CHECK2: %[[V2:.*]] = bitcast %"struct.test2::C"* %{{.*}} to i8* // CHECK2: %[[ADD_PTR:.*]] = getelementptr inbounds i8, i8* %[[V2]], i64 8 // CHECK2: %[[V3:.*]] = bitcast i8* %[[ADD_PTR]] to i8*** // CHECK2: %[[VTABLE2:.*]] = load i8**, i8*** %[[V3]] -// CHECK2: %[[CMP2:.*]] = icmp eq i8** %[[VTABLE2]], getelementptr inbounds ([6 x i8*], [6 x i8*]* @_ZTVN5test21CE, i64 0, i64 5) +// CHECK2: %[[CMP2:.*]] = icmp eq i8** %[[VTABLE2]], getelementptr inbounds ([6 x i8*], [6 x i8*]* @_ZTVN5test21CE, i32 0, i32 5) // CHECK2: call void @llvm.assume(i1 %[[CMP2]]) // CHECK2: call void @_ZN5test21gEPNS_1AE( @@ -111,7 +111,7 @@ void g(B *a) { a->foo(); } // CHECK3-LABEL: define void @_ZN5test34testEv() // CHECK3: call void @_ZN5test31CC1Ev(%"struct.test3::C"* -// CHECK3: %[[CMP:.*]] = icmp eq i8** %{{.*}}, getelementptr inbounds ([4 x i8*], [4 x i8*]* @_ZTVN5test31CE, i64 0, i64 3) +// CHECK3: %[[CMP:.*]] = icmp eq i8** %{{.*}}, getelementptr inbounds ([4 x i8*], [4 x i8*]* @_ZTVN5test31CE, i32 0, i32 3) // CHECK3: call void @llvm.assume(i1 %[[CMP]]) // CHECK3-LABLEL: } void test() { @@ -140,11 +140,11 @@ void g(C *c) { c->foo(); } // CHECK4-LABEL: define void @_ZN5test44testEv() // CHECK4: call void @_ZN5test41CC1Ev(%"struct.test4::C"* // CHECK4: %[[VTABLE:.*]] = load i8**, i8*** %{{.*}} -// CHECK4: %[[CMP:.*]] = icmp eq i8** %[[VTABLE]], getelementptr inbounds ([5 x i8*], [5 x i8*]* @_ZTVN5test41CE, i64 0, i64 4) +// CHECK4: %[[CMP:.*]] = icmp eq i8** %[[VTABLE]], getelementptr inbounds ([5 x i8*], [5 x i8*]* @_ZTVN5test41CE, i32 0, i32 4) // CHECK4: call void @llvm.assume(i1 %[[CMP]] // CHECK4: %[[VTABLE2:.*]] = load i8**, i8*** %{{.*}} -// CHECK4: %[[CMP2:.*]] = icmp eq i8** %[[VTABLE2]], getelementptr inbounds ([5 x i8*], [5 x i8*]* @_ZTVN5test41CE, i64 0, i64 4) +// CHECK4: %[[CMP2:.*]] = icmp eq i8** %[[VTABLE2]], getelementptr inbounds ([5 x i8*], [5 x i8*]* @_ZTVN5test41CE, i32 0, i32 4) // CHECK4: call void @llvm.assume(i1 %[[CMP2]]) // CHECK4-LABEL: } |