aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Bytecode
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
commite87e1c9aa947e6558412b6517308410cd0f5aea4 (patch)
treee64b7d79741476bd0070c8284ac6757ee0be1a83 /lib/Bytecode
parent05804b74590ab8714bd7695d8cd0d98819c092f9 (diff)
downloadexternal_llvm-e87e1c9aa947e6558412b6517308410cd0f5aea4.zip
external_llvm-e87e1c9aa947e6558412b6517308410cd0f5aea4.tar.gz
external_llvm-e87e1c9aa947e6558412b6517308410cd0f5aea4.tar.bz2
Change the MallocInst & AllocaInst ctors to take the allocated type, not the
pointer type returned. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3711 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode')
-rw-r--r--lib/Bytecode/Reader/InstructionReader.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Bytecode/Reader/InstructionReader.cpp b/lib/Bytecode/Reader/InstructionReader.cpp
index 0b75c41..4036099 100644
--- a/lib/Bytecode/Reader/InstructionReader.cpp
+++ b/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: