summaryrefslogtreecommitdiffstats
path: root/clang/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
commite4424888e4d46b1337dca8170f3cf688b86d8a95 (patch)
tree181fe06ba6024699548ee98b12aead026ebe2690 /clang/lib/CodeGen
parent3521552ebeb2c3afd103207655939ac00f96cff8 (diff)
downloadbcm5719-llvm-e4424888e4d46b1337dca8170f3cf688b86d8a95.tar.gz
bcm5719-llvm-e4424888e4d46b1337dca8170f3cf688b86d8a95.zip
When possible, use the vbase offset offsets from the most derived class directly.
llvm-svn: 98247
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGVtable.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGVtable.cpp b/clang/lib/CodeGen/CGVtable.cpp
index 3e07756ad5c..9f792993ac4 100644
--- a/clang/lib/CodeGen/CGVtable.cpp
+++ b/clang/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 &&
OpenPOWER on IntegriCloud