[cfe-commits] r90670 - /cfe/trunk/lib/CodeGen/CGCXX.cpp
Anders Carlsson
andersca at mac.com
Sat Dec 5 10:38:15 PST 2009
Author: andersca
Date: Sat Dec 5 12:38:15 2009
New Revision: 90670
URL: http://llvm.org/viewvc/llvm-project?rev=90670&view=rev
Log:
Simplify some code.
Modified:
cfe/trunk/lib/CodeGen/CGCXX.cpp
Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=90670&r1=90669&r2=90670&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Sat Dec 5 12:38:15 2009
@@ -1702,18 +1702,18 @@
PopCXXTemporary();
}
+ if (!ClassDecl->isDynamicClass())
+ return;
+
// Initialize the vtable pointer
- if (ClassDecl->isDynamicClass()) {
- if (!LoadOfThis)
- LoadOfThis = LoadCXXThis();
- llvm::Value *VtableField;
- llvm::Type *Ptr8Ty, *PtrPtr8Ty;
- Ptr8Ty = llvm::PointerType::get(llvm::Type::getInt8Ty(VMContext), 0);
- PtrPtr8Ty = llvm::PointerType::get(Ptr8Ty, 0);
- VtableField = Builder.CreateBitCast(LoadOfThis, PtrPtr8Ty);
- llvm::Value *vtable = CGM.getVtableInfo().getVtable(ClassDecl);
- Builder.CreateStore(vtable, VtableField);
- }
+ if (!LoadOfThis)
+ LoadOfThis = LoadCXXThis();
+
+ const llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(VMContext);
+ llvm::Value *VtableField =
+ Builder.CreateBitCast(LoadOfThis, Int8PtrTy->getPointerTo());
+ llvm::Value *vtable = CGM.getVtableInfo().getVtable(ClassDecl);
+ Builder.CreateStore(vtable, VtableField);
}
/// EmitDtorEpilogue - Emit all code that comes at the end of class's
More information about the cfe-commits
mailing list