diff options
author | Victor Hernandez <vhernandez@apple.com> | 2009-09-25 18:11:52 +0000 |
---|---|---|
committer | Victor Hernandez <vhernandez@apple.com> | 2009-09-25 18:11:52 +0000 |
commit | e6ff7662b67a358cf985c5133f9cb30f9d979e97 (patch) | |
tree | 9b2d337a2da01bb61d8059dd4f0088f4e9cad744 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
parent | 5aec1b54bce5f7e916acb7d758e052b04e0c2996 (diff) | |
download | llvm-e6ff7662b67a358cf985c5133f9cb30f9d979e97.zip llvm-e6ff7662b67a358cf985c5133f9cb30f9d979e97.tar.gz llvm-e6ff7662b67a358cf985c5133f9cb30f9d979e97.tar.bz2 |
Revert 82694 "Auto-upgrade malloc instructions to malloc calls." because it causes regressions in the nightly tests.
llvm-svn: 82784
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index be0ec4b..f3ab806 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -2046,21 +2046,14 @@ bool BitcodeReader::ParseFunctionBody(Function *F) { } case bitc::FUNC_CODE_INST_MALLOC: { // MALLOC: [instty, op, align] - // Autoupgrade malloc instruction to malloc call. if (Record.size() < 3) return Error("Invalid MALLOC record"); const PointerType *Ty = dyn_cast_or_null<PointerType>(getTypeByID(Record[0])); Value *Size = getFnValueByID(Record[1], Type::getInt32Ty(Context)); + unsigned Align = Record[2]; 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()); - if (Size->getType() != Int32Ty) - Size = CastInst::CreateIntegerCast(Size, Int32Ty, false /*ZExt*/, - "", CurBB); - Value* Malloc = CallInst::CreateMalloc(CurBB, Int32Ty, - Ty->getElementType(), Size, NULL); - I = cast<Instruction>(Malloc); + I = new MallocInst(Ty->getElementType(), Size, (1 << Align) >> 1); InstructionList.push_back(I); break; } |