[cfe-commits] r52334 - /cfe/trunk/lib/CodeGen/CGBuiltin.cpp
Chris Lattner
sabre at nondot.org
Mon Jun 16 10:15:14 PDT 2008
Author: lattner
Date: Mon Jun 16 12:15:14 2008
New Revision: 52334
URL: http://llvm.org/viewvc/llvm-project?rev=52334&view=rev
Log:
force size of alloca to i32, which is currently required by LLVM IR.
This fixes use of alloca on 64-bit systems.
Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=52334&r1=52333&r2=52334&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Jun 16 12:15:14 2008
@@ -261,10 +261,13 @@
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)),
More information about the cfe-commits
mailing list