start splitting out aggregate value computation from EmitExpr into EmitAggExpr.
aggregate value and scalar expression computation are very different, this
gets them away from each other. This causes a temporary regression on some
complex number examples.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41014 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CodeGen/CGStmt.cpp b/CodeGen/CGStmt.cpp
index 1e72c9d..131e2b5 100644
--- a/CodeGen/CGStmt.cpp
+++ b/CodeGen/CGStmt.cpp
@@ -31,7 +31,10 @@
// Must be an expression in a stmt context. Emit the value and ignore the
// result.
if (const Expr *E = dyn_cast<Expr>(S)) {
- EmitExpr(E);
+ if (hasAggregateLLVMType(E->getType()))
+ EmitAggExpr(E, 0, false); // Emit an aggregate, ignoring the result.
+ else
+ EmitExpr(E);
} else {
printf("Unimplemented stmt!\n");
S->dump();
@@ -257,7 +260,7 @@
// If there is an increment, emit it next.
if (S.getInc())
- EmitExpr(S.getInc());
+ EmitStmt(S.getInc());
// Finally, branch back up to the condition for the next iteration.
Builder.CreateBr(CondBlock);
@@ -274,6 +277,7 @@
// Emit the result value, even if unused, to evalute the side effects.
const Expr *RV = S.getRetValue();
+ // FIXME: Handle return of an aggregate!
if (RV)
RetVal = EmitExpr(RV);
else // Silence a bogus GCC warning.