[llvm-commits] CVS: llvm/lib/Bytecode/Reader/ReadInst.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Sep 13 17:30:24 PDT 2002


Changes in directory llvm/lib/Bytecode/Reader:

ReadInst.cpp updated: 1.37 -> 1.38

---
Log message:

Change the MallocInst & AllocaInst ctors to take the allocated type, not the
pointer type returned.



---
Diffs of the changes:

Index: llvm/lib/Bytecode/Reader/ReadInst.cpp
diff -u llvm/lib/Bytecode/Reader/ReadInst.cpp:1.37 llvm/lib/Bytecode/Reader/ReadInst.cpp:1.38
--- llvm/lib/Bytecode/Reader/ReadInst.cpp:1.37	Thu Aug 22 18:36:36 2002
+++ llvm/lib/Bytecode/Reader/ReadInst.cpp	Fri Sep 13 17:28:43 2002
@@ -329,13 +329,19 @@
   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:





More information about the llvm-commits mailing list