aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Bitcode
diff options
context:
space:
mode:
authorVictor Hernandez <vhernandez@apple.com>2009-09-25 18:11:52 +0000
committerVictor Hernandez <vhernandez@apple.com>2009-09-25 18:11:52 +0000
commit3e0c99a26f365bddb667124db40a5734e35c5a2d (patch)
tree406ef499eb4ee0c0b5f704d726d1d9c39ad79694 /lib/Bitcode
parenta45bfd31de14321262dd5f5123d04fc953a79ff1 (diff)
downloadexternal_llvm-3e0c99a26f365bddb667124db40a5734e35c5a2d.zip
external_llvm-3e0c99a26f365bddb667124db40a5734e35c5a2d.tar.gz
external_llvm-3e0c99a26f365bddb667124db40a5734e35c5a2d.tar.bz2
Revert 82694 "Auto-upgrade malloc instructions to malloc calls." because it causes regressions in the nightly tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82784 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode')
-rw-r--r--lib/Bitcode/Reader/BitcodeReader.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp
index be0ec4b..f3ab806 100644
--- a/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/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;
}