summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bytecode/Reader/InstructionReader.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-09-13 22:28:50 +0000
committerChris Lattner <sabre@nondot.org>2002-09-13 22:28:50 +0000
commitfc91ee91e83213eeef02291a810882ba581128f3 (patch)
tree401c42198e74e75e1983c288b5d0d092b7e3c98e /llvm/lib/Bytecode/Reader/InstructionReader.cpp
parent322bf4f3a99d58c1a3e411f9995b22a2efe8e0be (diff)
downloadbcm5719-llvm-fc91ee91e83213eeef02291a810882ba581128f3.tar.gz
bcm5719-llvm-fc91ee91e83213eeef02291a810882ba581128f3.zip
Change the MallocInst & AllocaInst ctors to take the allocated type, not the
pointer type returned. llvm-svn: 3711
Diffstat (limited to 'llvm/lib/Bytecode/Reader/InstructionReader.cpp')
-rw-r--r--llvm/lib/Bytecode/Reader/InstructionReader.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/Bytecode/Reader/InstructionReader.cpp b/llvm/lib/Bytecode/Reader/InstructionReader.cpp
index 0b75c41b008..40360991f5c 100644
--- a/llvm/lib/Bytecode/Reader/InstructionReader.cpp
+++ b/llvm/lib/Bytecode/Reader/InstructionReader.cpp
@@ -329,13 +329,19 @@ bool BytecodeParser::ParseInstruction(const uchar *&Buf, const uchar *EndBuf,
case Instruction::Malloc:
if (Raw.NumOperands > 2) return true;
V = Raw.NumOperands ? getValue(Type::UIntTy, Raw.Arg1) : 0;
- Res = new MallocInst(Raw.Ty, V);
+ if (const PointerType *PTy = dyn_cast<PointerType>(Raw.Ty))
+ Res = new MallocInst(PTy->getElementType(), V);
+ else
+ return true;
return false;
case Instruction::Alloca:
if (Raw.NumOperands > 2) return true;
V = Raw.NumOperands ? getValue(Type::UIntTy, Raw.Arg1) : 0;
- Res = new AllocaInst(Raw.Ty, V);
+ if (const PointerType *PTy = dyn_cast<PointerType>(Raw.Ty))
+ Res = new AllocaInst(PTy->getElementType(), V);
+ else
+ return true;
return false;
case Instruction::Free:
OpenPOWER on IntegriCloud