the type field for a store is the type of the pointer, not the value.

With this fix I can round trip treeaadd, only losing calling conv info.

llvm-svn: 36706
This commit is contained in:
Chris Lattner 2007-05-03 22:21:59 +00:00
parent 4bb39dbfde
commit c1d86cda8c
1 changed files with 4 additions and 3 deletions

View File

@ -1351,9 +1351,10 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
case bitc::FUNC_CODE_INST_STORE: { // STORE:[ptrty,val,ptr, align, vol]
if (Record.size() < 5)
return Error("Invalid LOAD record");
const Type *OpTy = getTypeByID(Record[0]);
Value *Op = getFnValueByID(Record[1], OpTy);
Value *Ptr = getFnValueByID(Record[2], PointerType::get(OpTy));
const PointerType *OpTy =
dyn_cast_or_null<PointerType>(getTypeByID(Record[0]));
Value *Op = getFnValueByID(Record[1], OpTy ? OpTy->getElementType() : 0);
Value *Ptr = getFnValueByID(Record[2], OpTy);
if (!OpTy || !Op || !Ptr)
return Error("Invalid STORE record");
I = new StoreInst(Op, Ptr, (1 << Record[3]) >> 1, Record[4]);