aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGBuiltin.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-06-16 17:15:14 +0000
committerChris Lattner <sabre@nondot.org>2008-06-16 17:15:14 +0000
commit9e800e3dd80d77f6c47054738177bf824089f55a (patch)
tree68eef8753e3a528defc77644eb30ecf7ce9be190 /lib/CodeGen/CGBuiltin.cpp
parent1e692ace08959399794363e77499b73da5494af9 (diff)
force size of alloca to i32, which is currently required by LLVM IR.
This fixes use of alloca on 64-bit systems. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52334 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGBuiltin.cpp')
-rw-r--r--lib/CodeGen/CGBuiltin.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp
index 51d7ced2d8..f8132f417d 100644
--- a/lib/CodeGen/CGBuiltin.cpp
+++ b/lib/CodeGen/CGBuiltin.cpp
@@ -261,10 +261,13 @@ RValue CodeGenFunction::EmitBuiltinExpr(unsigned BuiltinID, const CallExpr *E) {
return RValue::get(Builder.CreateZExt(LHS, ConvertType(E->getType()),
"tmp"));
}
- case Builtin::BI__builtin_alloca:
- return RValue::get(Builder.CreateAlloca(llvm::Type::Int8Ty,
- EmitScalarExpr(E->getArg(0)),
+ case Builtin::BI__builtin_alloca: {
+ // FIXME: LLVM IR Should allow alloca with an i64 size!
+ Value *Size = EmitScalarExpr(E->getArg(0));
+ Size = Builder.CreateIntCast(Size, llvm::Type::Int32Ty, false, "tmp");
+ return RValue::get(Builder.CreateAlloca(llvm::Type::Int8Ty, Size,
"tmp"));
+ }
case Builtin::BI__builtin_memcpy: {
Value* MemCpyOps[4] = {
EmitScalarExpr(E->getArg(0)),