aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprAgg.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-12-04 01:30:56 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-12-04 01:30:56 +0000
commit13a5be10b198a5dc7e3e72c54481cd8b70f68495 (patch)
treea40ef45f2ebcc5d006b6165e52579af8e3faed5e /lib/CodeGen/CGExprAgg.cpp
parent0ee4124012950d7bb853438629b8e7652febf183 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90510 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprAgg.cpp')
-rw-r--r--lib/CodeGen/CGExprAgg.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp
index d225d907c8..d53dbb7346 100644
--- a/lib/CodeGen/CGExprAgg.cpp
+++ b/lib/CodeGen/CGExprAgg.cpp
@@ -502,21 +502,16 @@ void AggExprEmitter::EmitNullInitializationToLValue(LValue LV, QualType T) {
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