aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-03-11 07:00:45 +0000
committerAnders Carlsson <andersca@mac.com>2010-03-11 07:00:45 +0000
commit1972ced0061bb0bf7e3237b0c06ad95b4923f9e4 (patch)
treef1f10ee70f9319c8d256996fadc7cd77d1c963ac /lib/CodeGen
parent127e46727ed39703a7baa3218d2681082d931c92 (diff)
When possible, use the vbase offset offsets from the most derived class directly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98247 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/CGVtable.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp
index 3e07756ad5..9f792993ac 100644
--- a/lib/CodeGen/CGVtable.cpp
+++ b/lib/CodeGen/CGVtable.cpp
@@ -1406,9 +1406,16 @@ VtableBuilder::ComputeReturnAdjustment(BaseOffset Offset) {
if (!Offset.isEmpty()) {
if (Offset.VirtualBase) {
// Get the virtual base offset offset.
- Adjustment.VBaseOffsetOffset =
- VtableInfo.getVirtualBaseOffsetIndex(Offset.DerivedClass,
- Offset.VirtualBase);
+ if (Offset.DerivedClass == MostDerivedClass) {
+ // We can get the offset offset directly from our map.
+ Adjustment.VBaseOffsetOffset =
+ VBaseOffsetOffsets.lookup(Offset.VirtualBase);
+ } else {
+ Adjustment.VBaseOffsetOffset =
+ VtableInfo.getVirtualBaseOffsetIndex(Offset.DerivedClass,
+ Offset.VirtualBase);
+ }
+
// FIXME: Once the assert in getVirtualBaseOffsetIndex is back again,
// we can get rid of this assert.
assert(Adjustment.VBaseOffsetOffset != 0 &&