[cfe-commits] r96376 - in /cfe/trunk: lib/CodeGen/CodeGenFunction.cpp test/CodeGenCXX/alloca-align.cpp
Daniel Dunbar
daniel at zuster.org
Tue Feb 16 11:45:22 PST 2010
Author: ddunbar
Date: Tue Feb 16 13:45:20 2010
New Revision: 96376
URL: http://llvm.org/viewvc/llvm-project?rev=96376&view=rev
Log:
IRgen: Switch 'retval' to use CreateIRTemp.
Modified:
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
cfe/trunk/test/CodeGenCXX/alloca-align.cpp
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=96376&r1=96375&r2=96376&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Tue Feb 16 13:45:20 2010
@@ -216,10 +216,10 @@
} else if (CurFnInfo->getReturnInfo().getKind() == ABIArgInfo::Indirect &&
hasAggregateLLVMType(CurFnInfo->getReturnType())) {
// Indirect aggregate return; emit returned value directly into sret slot.
- // This reduces code size, and is also affects correctness in C++.
+ // This reduces code size, and affects correctness in C++.
ReturnValue = CurFn->arg_begin();
} else {
- ReturnValue = CreateTempAlloca(ConvertType(RetTy), "retval");
+ ReturnValue = CreateIRTemp(RetTy, "retval");
}
EmitStartEHSpec(CurCodeDecl);
Modified: cfe/trunk/test/CodeGenCXX/alloca-align.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/alloca-align.cpp?rev=96376&r1=96375&r2=96376&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/alloca-align.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/alloca-align.cpp Tue Feb 16 13:45:20 2010
@@ -1,19 +1,28 @@
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
-//
-// CHECK: define void @f0
-// CHECK: alloca %struct.s0, align 16
-// CHECK: define void @f1
-// CHECK: alloca %struct.s0, align 16
struct s0 {
int Start, End;
unsigned Alignment;
int TheStores __attribute__((aligned(16)));
};
+
+// CHECK: define void @f0
+// CHECK: alloca %struct.s0, align 16
extern "C" void f0() {
(void) s0();
}
+// CHECK: define void @f1
+// CHECK: alloca %struct.s0, align 16
extern "C" void f1() {
- (struct s0) { 0, 0, 0, 0 };
+ (void) (struct s0) { 0, 0, 0, 0 };
+}
+
+// CHECK: define i64 @f2
+// CHECK: alloca %struct.s1, align 2
+struct s1 { short x; short y; };
+extern "C" struct s1 f2(int a, struct s1 *x, struct s1 *y) {
+ if (a)
+ return *x;
+ return *y;
}
More information about the cfe-commits
mailing list