aboutsummaryrefslogtreecommitdiff
path: root/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-05-03 22:21:59 +0000
committerChris Lattner <sabre@nondot.org>2007-05-03 22:21:59 +0000
commitc9c55a9d2fc63ee87cf00e80736f6508507f2444 (patch)
tree0826e5f49e59bab40a050589b0ae410c445dc47b /lib/Bitcode/Reader/BitcodeReader.cpp
parent38b12ce1864a49e1c00b2d9fb5da83c69f77fcec (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36706 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--lib/Bitcode/Reader/BitcodeReader.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp
index 1ab9f54d5b..8396d442fc 100644
--- a/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/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]);