Let the VTT builder pretend that getVtable returns a pointer to the vtable and not to the vtable address point.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90672 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp
index 6408853..e7f170f 100644
--- a/lib/CodeGen/CGVtable.cpp
+++ b/lib/CodeGen/CGVtable.cpp
@@ -1264,7 +1264,7 @@
       
       VtblClass = RD;
     }
-    llvm::Constant *vtbl = dyn_cast<llvm::Constant>(init->getOperand(0));
+    llvm::Constant *vtbl = cast<llvm::Constant>(init->getOperand(0));
     Inits.push_back(init);
 
     // then the secondary VTTs....
@@ -1316,9 +1316,9 @@
       VMContext(cgm.getModule().getContext()) {
     
     // First comes the primary virtual table pointer for the complete class...
-    ClassVtbl = CGM.getVtableInfo().getVtable(Class);
-    Inits.push_back(ClassVtbl);
-    ClassVtbl = dyn_cast<llvm::Constant>(ClassVtbl->getOperand(0));
+    ClassVtbl = cast<llvm::Constant>(CGM.getVtableInfo().getVtable(Class)
+                                     ->getOperand(0));
+    Inits.push_back(BuildVtablePtr(ClassVtbl, Class, Class, 0));
     
     // then the secondary VTTs...
     SecondaryVTTs(Class);