aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGCall.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-06-15 18:26:32 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-06-15 18:26:32 +0000
commit70cbd2a2a07ff3109adb2d584f7ad4b5cce88af2 (patch)
tree2d975a1a88a06ec86d0db73ed2d015283ec1dc1f /lib/CodeGen/CGCall.cpp
parent98703d32ff37fbfbcfd844241d2be44b8f80cf9f (diff)
Fix a regression from r132957 involving complex integers. (Fixes failures on gcc-testsuite bot.)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133069 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCall.cpp')
-rw-r--r--lib/CodeGen/CGCall.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp
index 5e9ecd574b..b80787bb18 100644
--- a/lib/CodeGen/CGCall.cpp
+++ b/lib/CodeGen/CGCall.cpp
@@ -1189,7 +1189,8 @@ void CodeGenFunction::EmitCallArg(CallArgList &args, const Expr *E,
return args.add(EmitReferenceBindingToExpr(E, /*InitializedDecl=*/0),
type);
- if (hasAggregateLLVMType(type) && isa<ImplicitCastExpr>(E) &&
+ if (hasAggregateLLVMType(type) && !E->getType()->isAnyComplexType() &&
+ isa<ImplicitCastExpr>(E) &&
cast<CastExpr>(E)->getCastKind() == CK_LValueToRValue) {
LValue L = EmitLValue(cast<CastExpr>(E)->getSubExpr());
assert(L.isSimple());
@@ -1257,7 +1258,10 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
case ABIArgInfo::Indirect: {
if (RV.isScalar() || RV.isComplex()) {
// Make a temporary alloca to pass the argument.
- Args.push_back(CreateMemTemp(I->Ty));
+ llvm::AllocaInst *AI = CreateMemTemp(I->Ty);
+ if (ArgInfo.getIndirectAlign() > AI->getAlignment())
+ AI->setAlignment(ArgInfo.getIndirectAlign());
+ Args.push_back(AI);
if (RV.isScalar())
EmitStoreOfScalar(RV.getScalarVal(), Args.back(), false,
Alignment, I->Ty);