Inching our way towards fixing PR82
authorChris Lattner <sabre@nondot.org>
Fri, 9 Jan 2004 05:42:34 +0000 (05:42 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 9 Jan 2004 05:42:34 +0000 (05:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10721 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Bytecode/Reader/InstructionReader.cpp

index 3ca00f35cc66f1418b8fb9af8f6d037b7c87ea58..4beb2b0c11dc25ee032bafbd157b1e8a469b7c3e 100644 (file)
@@ -354,7 +354,10 @@ void BytecodeParser::ParseInstruction(const unsigned char *&Buf,
     for (unsigned i = 1, e = Args.size(); i != e; ++i) {
       const CompositeType *TopTy = dyn_cast_or_null<CompositeType>(NextTy);
       if (!TopTy) throw std::string("Invalid getelementptr instruction!"); 
-      Idx.push_back(getValue(TopTy->getIndexType()->getPrimitiveID(), Args[i]));
+      // FIXME: when PR82 is resolved.
+      unsigned IdxTy = isa<StructType>(TopTy) ? Type::UByteTyID :Type::LongTyID;
+        
+      Idx.push_back(getValue(IdxTy, Args[i]));
       NextTy = GetElementPtrInst::getIndexedType(InstTy, Idx, true);
     }