summaryrefslogtreecommitdiffstats
path: root/llvm/lib/AsmParser/LLParser.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-05-28 01:14:11 +0000
committerDan Gohman <gohman@apple.com>2010-05-28 01:14:11 +0000
commit2140a749793572ce0173c2ff5bbbd1fafc7bd2ee (patch)
tree62b2ad4219f40c07396fbbc21a092d410999752b /llvm/lib/AsmParser/LLParser.cpp
parentdd5904687f5ed2e9451ce4520b64ae172a9d00a1 (diff)
downloadbcm5719-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.cpp6
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);
OpenPOWER on IntegriCloud