aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorVictor Hernandez <vhernandez@apple.com>2009-10-21 19:11:40 +0000
committerVictor Hernandez <vhernandez@apple.com>2009-10-21 19:11:40 +0000
commit67439f05c61cd2445416d7f4f32c4062827376da (patch)
treea8c1c6300819ecbde4ff9cdc64e7b72ae0f370a5 /lib/Bitcode/Reader/BitcodeReader.cpp
parente33f252643208755c07a6b43082f20d05b15af42 (diff)
downloadexternal_llvm-67439f05c61cd2445416d7f4f32c4062827376da.zip
external_llvm-67439f05c61cd2445416d7f4f32c4062827376da.tar.gz
external_llvm-67439f05c61cd2445416d7f4f32c4062827376da.tar.bz2
Make changes to rev 84292 as requested by Chris Lattner.
Most changes are cleanup, but there is 1 correctness fix: I fixed InstCombine so that the icmp is removed only if the malloc call is removed (which requires explicit removal because the Worklist won't DCE any calls since they can have side-effects). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84772 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--lib/Bitcode/Reader/BitcodeReader.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp
index fe4556f..c9eba24 100644
--- a/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -2045,6 +2045,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
case bitc::FUNC_CODE_INST_MALLOC: { // MALLOC: [instty, op, align]
// Autoupgrade malloc instruction to malloc call.
+ // FIXME: Remove in LLVM 3.0.
if (Record.size() < 3)
return Error("Invalid MALLOC record");
const PointerType *Ty =
@@ -2052,13 +2053,9 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
Value *Size = getFnValueByID(Record[1], Type::getInt32Ty(Context));
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);
+ const Type *Int32Ty = IntegerType::getInt32Ty(CurBB->getContext());
+ I = CallInst::CreateMalloc(CurBB, Int32Ty, Ty->getElementType(),
+ Size, NULL);
InstructionList.push_back(I);
break;
}