[llvm-commits] CVS: llvm/lib/Bitcode/Reader/BitcodeReader.cpp
Chris Lattner
sabre at nondot.org
Thu May 3 15:22:17 PDT 2007
Changes in directory llvm/lib/Bitcode/Reader:
BitcodeReader.cpp updated: 1.28 -> 1.29
---
Log message:
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.
---
Diffs of the changes: (+4 -3)
BitcodeReader.cpp | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
Index: llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff -u llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.28 llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.29
--- llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.28 Thu May 3 17:18:21 2007
+++ llvm/lib/Bitcode/Reader/BitcodeReader.cpp Thu May 3 17:21:59 2007
@@ -1351,9 +1351,10 @@
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]);
More information about the llvm-commits
mailing list