[cfe-commits] r133069 - in /cfe/trunk: lib/CodeGen/CGCall.cpp test/CodeGen/complex-indirect.c
Eli Friedman
eli.friedman at gmail.com
Wed Jun 15 11:26:32 PDT 2011
Author: efriedma
Date: Wed Jun 15 13:26:32 2011
New Revision: 133069
URL: http://llvm.org/viewvc/llvm-project?rev=133069&view=rev
Log:
Fix a regression from r132957 involving complex integers. (Fixes failures on gcc-testsuite bot.)
Added:
cfe/trunk/test/CodeGen/complex-indirect.c
Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=133069&r1=133068&r2=133069&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Wed Jun 15 13:26:32 2011
@@ -1189,7 +1189,8 @@
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 @@
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);
Added: cfe/trunk/test/CodeGen/complex-indirect.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/complex-indirect.c?rev=133069&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/complex-indirect.c (added)
+++ cfe/trunk/test/CodeGen/complex-indirect.c Wed Jun 15 13:26:32 2011
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin10 | FileCheck %s
+
+// Make sure this doesn't crash, and that we don't generate a byval alloca
+// with insufficient alignment.
+
+void a(int,int,int,int,int,int,__complex__ char);
+void b(__complex__ char *y) { a(0,0,0,0,0,0,*y); }
+// CHECK: define void @b
+// CHECK: alloca %0, align 8
+// CHECK: call void @a(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, %0* byval align 8
More information about the cfe-commits
mailing list