1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

[opaque pointer type] Access the pointee of the result type from the GEP rather than pulling it out of the pointer result type

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?).

llvm-svn: 235236
This commit is contained in:
David Blaikie 2015-04-17 22:32:20 +00:00
parent 70f557413f
commit 8a16658970
2 changed files with 4 additions and 3 deletions

View File

@ -876,7 +876,9 @@ public:
->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 {

View File

@ -2462,8 +2462,7 @@ void Verifier::visitGetElementPtrInst(GetElementPtrInst &GEP) {
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()) {