aboutsummaryrefslogtreecommitdiff
path: root/lib/Bytecode
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Bytecode')
-rw-r--r--lib/Bytecode/Reader/InstructionReader.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Bytecode/Reader/InstructionReader.cpp b/lib/Bytecode/Reader/InstructionReader.cpp
index 3ca00f35cc..4beb2b0c11 100644
--- a/lib/Bytecode/Reader/InstructionReader.cpp
+++ b/lib/Bytecode/Reader/InstructionReader.cpp
@@ -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);
}