[cfe-commits] r134866 - in /cfe/trunk: lib/CodeGen/CodeGenTypes.cpp test/CodeGenCXX/template-anonymous-types.cpp

Chris Lattner sabre at nondot.org
Sat Jul 9 23:03:22 PDT 2011


Author: lattner
Date: Sun Jul 10 01:03:22 2011
New Revision: 134866

URL: http://llvm.org/viewvc/llvm-project?rev=134866&view=rev
Log:
implement a nice new optimization: CodeGenTypes::UpdateCompletedType
is called whenever a tag type is completed.  We previously used that
as the sign to layout the codegen representation for the tag type,
which worked but meant that we laid out *every* completed type, whether
it was used or not.

Now we just lay out the type if we've already seen it somehow else.
This means that we lay out types we've used but haven't seen a body
for, but we don't lay out tons of stuff that noone cares about.


Modified:
    cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
    cfe/trunk/test/CodeGenCXX/template-anonymous-types.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.cpp?rev=134866&r1=134865&r2=134866&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.cpp Sun Jul 10 01:03:22 2011
@@ -167,7 +167,7 @@
 
   // Only complete it if we converted it already.  If we haven't converted it
   // yet, we'll just do it lazily.
- // if (RecordDeclTypes.count(Context.getTagDeclType(RD).getTypePtr()))
+  if (RecordDeclTypes.count(Context.getTagDeclType(RD).getTypePtr()))
     ConvertRecordDeclType(RD);
 }
 

Modified: cfe/trunk/test/CodeGenCXX/template-anonymous-types.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/template-anonymous-types.cpp?rev=134866&r1=134865&r2=134866&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/template-anonymous-types.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/template-anonymous-types.cpp Sun Jul 10 01:03:22 2011
@@ -28,10 +28,10 @@
   // reverse order.
   //
   // BAR's instantiation of X:
-  // CHECK: define internal i32 @"_ZN1XIN1S3$_1EE1fEv"(%struct.X.0* %this)
-  // CHECK: define internal void @"_ZN1XIN1S3$_1EEC2ES1_"(%struct.X.0* %this, i32 %t) unnamed_addr
+  // CHECK: define internal i32 @"_ZN1XIN1S3$_1EE1fEv"(%struct.X* %this)
+  // CHECK: define internal void @"_ZN1XIN1S3$_1EEC2ES1_"(%struct.X* %this, i32 %t) unnamed_addr
   //
   // FOO's instantiation of X:
-  // CHECK: define internal i32 @"_ZN1XIN1S3$_0EE1fEv"(%struct.X* %this)
-  // CHECK: define internal void @"_ZN1XIN1S3$_0EEC2ES1_"(%struct.X* %this, i32 %t) unnamed_addr
+  // CHECK: define internal i32 @"_ZN1XIN1S3$_0EE1fEv"(%struct.X.0* %this)
+  // CHECK: define internal void @"_ZN1XIN1S3$_0EEC2ES1_"(%struct.X.0* %this, i32 %t) unnamed_addr
 }





More information about the cfe-commits mailing list