diff options
author | Roman Divacky <rdivacky@FreeBSD.org> | 2009-11-05 17:17:44 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@FreeBSD.org> | 2009-11-05 17:17:44 +0000 |
commit | 72cc50852bec44580ee7efe1aa2076273008a6ae (patch) | |
tree | adc0bc5dc9cb37579ee90d3c0f08c98c0711bebe /lib/Bitcode/Reader/BitcodeReader.cpp | |
parent | fc25e9aa52455d7aa75f3237afd79b8d89548bb5 (diff) |
Notes
Diffstat (limited to 'lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r-- | lib/Bitcode/Reader/BitcodeReader.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 68527e3d4749..9916388dad10 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -2101,8 +2101,10 @@ bool BitcodeReader::ParseFunctionBody(Function *F) { if (!Ty || !Size) return Error("Invalid MALLOC record"); if (!CurBB) return Error("Invalid malloc instruction with no BB"); const Type *Int32Ty = IntegerType::getInt32Ty(CurBB->getContext()); + Constant *AllocSize = ConstantExpr::getSizeOf(Ty->getElementType()); + AllocSize = ConstantExpr::getTruncOrBitCast(AllocSize, Int32Ty); I = CallInst::CreateMalloc(CurBB, Int32Ty, Ty->getElementType(), - Size, NULL); + AllocSize, Size, NULL); InstructionList.push_back(I); break; } |