aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-02-16 19:45:20 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-02-16 19:45:20 +0000
commit647a1ec397fa13af176d07d9f5d071560a94c7a9 (patch)
treeb6725fcfcac5f326c6293d2f7551711172a80653
parent75d113711eb4e40029bb0426365396b76281deee (diff)
IRgen: Switch 'retval' to use CreateIRTemp.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96376 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CodeGenFunction.cpp4
-rw-r--r--test/CodeGenCXX/alloca-align.cpp21
2 files changed, 17 insertions, 8 deletions
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp
index 5a4f94e3e0..febffc9697 100644
--- a/lib/CodeGen/CodeGenFunction.cpp
+++ b/lib/CodeGen/CodeGenFunction.cpp
@@ -216,10 +216,10 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
} 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);
diff --git a/test/CodeGenCXX/alloca-align.cpp b/test/CodeGenCXX/alloca-align.cpp
index b496e039e9..b70e366f4c 100644
--- a/test/CodeGenCXX/alloca-align.cpp
+++ b/test/CodeGenCXX/alloca-align.cpp
@@ -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;
}