[cfe-commits] r90510 - /cfe/trunk/lib/CodeGen/CGExprAgg.cpp

Eli Friedman eli.friedman at gmail.com
Thu Dec 3 17:30:56 PST 2009


Author: efriedma
Date: Thu Dec  3 19:30:56 2009
New Revision: 90510

URL: http://llvm.org/viewvc/llvm-project?rev=90510&view=rev
Log:
Update chunk of #if 0'ed code to remove fixed FIXME and make it compile.  We
probably want to do some sort of performance assessment before enabling it,
though.


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

Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=90510&r1=90509&r2=90510&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Thu Dec  3 19:30:56 2009
@@ -502,21 +502,16 @@
 
 void AggExprEmitter::VisitInitListExpr(InitListExpr *E) {
 #if 0
-  // FIXME: Disabled while we figure out what to do about
-  // test/CodeGen/bitfield.c
+  // FIXME: Assess perf here?  Figure out what cases are worth optimizing here
+  // (Length of globals? Chunks of zeroed-out space?).
   //
   // If we can, prefer a copy from a global; this is a lot less code for long
   // globals, and it's easier for the current optimizers to analyze.
-  // FIXME: Should we really be doing this? Should we try to avoid cases where
-  // we emit a global with a lot of zeros?  Should we try to avoid short
-  // globals?
-  if (E->isConstantInitializer(CGF.getContext(), 0)) {
-    llvm::Constant* C = CGF.CGM.EmitConstantExpr(E, &CGF);
+  if (llvm::Constant* C = CGF.CGM.EmitConstantExpr(E, E->getType(), &CGF)) {
     llvm::GlobalVariable* GV =
-    new llvm::GlobalVariable(C->getType(), true,
-                             llvm::GlobalValue::InternalLinkage,
-                             C, "", &CGF.CGM.getModule(), 0);
-    EmitFinalDestCopy(E, LValue::MakeAddr(GV, 0));
+    new llvm::GlobalVariable(CGF.CGM.getModule(), C->getType(), true,
+                             llvm::GlobalValue::InternalLinkage, C, "");
+    EmitFinalDestCopy(E, LValue::MakeAddr(GV, Qualifiers()));
     return;
   }
 #endif





More information about the cfe-commits mailing list