diff options
author | Dan Gohman <gohman@apple.com> | 2010-05-28 01:14:11 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-05-28 01:14:11 +0000 |
commit | 2140a749793572ce0173c2ff5bbbd1fafc7bd2ee (patch) | |
tree | 62b2ad4219f40c07396fbbc21a092d410999752b /llvm/lib/AsmParser/LLParser.cpp | |
parent | dd5904687f5ed2e9451ce4520b64ae172a9d00a1 (diff) | |
download | bcm5719-llvm-2140a749793572ce0173c2ff5bbbd1fafc7bd2ee.tar.gz bcm5719-llvm-2140a749793572ce0173c2ff5bbbd1fafc7bd2ee.zip |
Eliminate the restriction that the array size in an alloca must be i32.
This will help reduce the amount of casting required on 64-bit targets.
llvm-svn: 104911
Diffstat (limited to 'llvm/lib/AsmParser/LLParser.cpp')
-rw-r--r-- | llvm/lib/AsmParser/LLParser.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index 226d8d32729..1cd66e536ea 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -3791,8 +3791,8 @@ int LLParser::ParseAlloc(Instruction *&Inst, PerFunctionState &PFS, } } - if (Size && !Size->getType()->isIntegerTy(32)) - return Error(SizeLoc, "element count must be i32"); + if (Size && !Size->getType()->isIntegerTy()) + return Error(SizeLoc, "element count must have integer type"); if (isAlloca) { Inst = new AllocaInst(Ty, Size, Alignment); @@ -3801,6 +3801,8 @@ int LLParser::ParseAlloc(Instruction *&Inst, PerFunctionState &PFS, // Autoupgrade old malloc instruction to malloc call. // FIXME: Remove in LLVM 3.0. + if (Size && !Size->getType()->isIntegerTy(32)) + return Error(SizeLoc, "element count must be i32"); const Type *IntPtrTy = Type::getInt32Ty(Context); Constant *AllocSize = ConstantExpr::getSizeOf(Ty); AllocSize = ConstantExpr::getTruncOrBitCast(AllocSize, IntPtrTy); |