The implementation of this GEP::getResultElementType will be refactored
to either rely on a member variable, or recompute the value from the
indicies (any preferences?).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235236
91177308-0d34-0410-b5e6-
96231b3b80d8
->getElementType();
}
- Type *getResultElementType() const { return getType()->getElementType(); }
+ Type *getResultElementType() const {
+ return cast<PointerType>(getType()->getScalarType())->getElementType();
+ }
/// \brief Returns the address space of this instruction's pointer type.
unsigned getAddressSpace() const {
Assert(ElTy, "Invalid indices for GEP pointer type!", &GEP);
Assert(GEP.getType()->getScalarType()->isPointerTy() &&
- cast<PointerType>(GEP.getType()->getScalarType())
- ->getElementType() == ElTy,
+ GEP.getResultElementType() == ElTy,
"GEP is not of right type for indices!", &GEP, ElTy);
if (GEP.getPointerOperandType()->isVectorTy()) {