Split complex arithmetic codegen out from aggregate codegen.
This means that we get rid of tons of intermediate allocas. For
example:
void foo(double _Complex a, double _Complex b) {
a = b+a+a;
}
this used to have 4 temporary allocas, now it has zero of them.
This also simplifies the individual visitor methods because they
now can all operate on real/imag pairs instead of having to
load/store all over the place.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41217 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CodeGen/CGStmt.cpp b/CodeGen/CGStmt.cpp
index 131e2b5..c128abc 100644
--- a/CodeGen/CGStmt.cpp
+++ b/CodeGen/CGStmt.cpp
@@ -31,7 +31,9 @@
// Must be an expression in a stmt context. Emit the value and ignore the
// result.
if (const Expr *E = dyn_cast<Expr>(S)) {
- if (hasAggregateLLVMType(E->getType()))
+ if (E->getType()->isComplexType()) {
+ EmitComplexExpr(E);
+ } else if (hasAggregateLLVMType(E->getType()))
EmitAggExpr(E, 0, false); // Emit an aggregate, ignoring the result.
else
EmitExpr(E);