Author: kjdyck
Date: Fri Apr  8 20:09:56 2011
New Revision: 129179

URL: http://llvm.org/viewvc/llvm-project?rev=129179&view=rev
Log:
Eliminate a divide-by-8 in BuildVMIClassTypeInfo() by using CharUnits for
the base offset. No change in functionality intended.

Modified:
    cfe/trunk/lib/CodeGen/CGRTTI.cpp

Modified: cfe/trunk/lib/CodeGen/CGRTTI.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGRTTI.cpp?rev=129179&r1=129178&r2=129179&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGRTTI.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGRTTI.cpp Fri Apr  8 20:09:56 2011
@@ -877,15 +877,16 @@
     // For a non-virtual base, this is the offset in the object of the base
     // subobject. For a virtual base, this is the offset in the virtual table 
of
     // the virtual base offset for the virtual base referenced (negative).
+    CharUnits Offset;
     if (Base->isVirtual())
-      OffsetFlags = 
-        CGM.getVTables().getVirtualBaseOffsetOffset(RD, 
BaseDecl).getQuantity();
+      Offset = 
+        CGM.getVTables().getVirtualBaseOffsetOffset(RD, BaseDecl);
     else {
       const ASTRecordLayout &Layout = CGM.getContext().getASTRecordLayout(RD);
-      OffsetFlags = Layout.getBaseClassOffsetInBits(BaseDecl) / 8;
+      Offset = Layout.getBaseClassOffset(BaseDecl);
     };
     
-    OffsetFlags <<= 8;
+    OffsetFlags = Offset.getQuantity() << 8;
     
     // The low-order byte of __offset_flags contains flags, as given by the 
     // masks from the enumeration __offset_flags_masks.


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to