diff options
author | Chris Lattner <sabre@nondot.org> | 2007-05-03 22:21:59 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-05-03 22:21:59 +0000 |
commit | c1d86cda8c00163874a3d13b64888c842459de75 (patch) | |
tree | 50a0a82e64dd13ff891a6df95316cfa5354f0de8 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
parent | 4bb39dbfde5231b1ba1eda2552f3d51605e37fe6 (diff) | |
download | bcm5719-llvm-c1d86cda8c00163874a3d13b64888c842459de75.tar.gz bcm5719-llvm-c1d86cda8c00163874a3d13b64888c842459de75.zip |
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
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 1ab9f54d5bf..8396d442fc5 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -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]); |