Fix bug in new assertion
authorChris Lattner <sabre@nondot.org>
Mon, 12 Nov 2001 21:48:38 +0000 (21:48 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 12 Nov 2001 21:48:38 +0000 (21:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1279 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Bytecode/Reader/InstructionReader.cpp

index 6587ab214581f5d133ef293fd322fca18c1c4280..8dc9b8d565a0c1aacaf449bc57dd478e9ce9ce8a 100644 (file)
@@ -376,14 +376,17 @@ bool BytecodeParser::ParseInstruction(const uchar *&Buf, const uchar *EndBuf,
       delete Raw.VarArgs; 
       break;
     }
-    assert(LoadInst::getIndexedType(Raw.Ty, Idx) && 
-           "Bad indices for GEP or Load!");
-    if (Raw.Opcode == Instruction::Load)
+
+    if (Raw.Opcode == Instruction::Load) {
+      assert(MemAccessInst::getIndexedType(Raw.Ty, Idx) && 
+             "Bad indices for GEP or Load!");
       Res = new LoadInst(getValue(Raw.Ty, Raw.Arg1), Idx);
-    else if (Raw.Opcode == Instruction::GetElementPtr)
+    else if (Raw.Opcode == Instruction::GetElementPtr)
       Res = new GetElementPtrInst(getValue(Raw.Ty, Raw.Arg1), Idx);
     else
       abort();
+    if (!MemAccessInst::getIndexedType(Raw.Ty, Idx))
+      cerr << Res;
     return false;
   }
   case Instruction::Store: {