[opaque pointer type] Change GetElementPtrInst::getIndexedType to take the pointee...
[oota-llvm.git] / lib / Analysis / InstructionSimplify.cpp
index 99c477d46236fc5792e8026f2c6ba99482e6bf9e..e88232368fd25157683c6b95dc4a9363624c4d9d 100644 (file)
@@ -3251,7 +3251,8 @@ static Value *SimplifyGEPInst(ArrayRef<Value *> Ops, const Query &Q, unsigned) {
     return Ops[0];
 
   // Compute the (pointer) type returned by the GEP instruction.
-  Type *LastType = GetElementPtrInst::getIndexedType(PtrTy, Ops.slice(1));
+  Type *LastType =
+      GetElementPtrInst::getIndexedType(PtrTy->getElementType(), Ops.slice(1));
   Type *GEPTy = PointerType::get(LastType, AS);
   if (VectorType *VT = dyn_cast<VectorType>(Ops[0]->getType()))
     GEPTy = VectorType::get(GEPTy, VT->getNumElements());