summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2015-04-17 22:32:20 +0000
committerDavid Blaikie <dblaikie@gmail.com>2015-04-17 22:32:20 +0000
commitd0a2482870218dce13c629f5acce96d8dafffcfd (patch)
tree0cabe6cbcc64a933f97edbd1a90c8f517bfc027d
parentcc2cd581cf2fb650296b63344ffb7e205027e308 (diff)
downloadbcm5719-llvm-d0a2482870218dce13c629f5acce96d8dafffcfd.tar.gz
bcm5719-llvm-d0a2482870218dce13c629f5acce96d8dafffcfd.zip
[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
-rw-r--r--llvm/include/llvm/IR/Instructions.h4
-rw-r--r--llvm/lib/IR/Verifier.cpp3
2 files changed, 4 insertions, 3 deletions
diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h
index ff9254372ea..2571faf3836 100644
--- a/llvm/include/llvm/IR/Instructions.h
+++ b/llvm/include/llvm/IR/Instructions.h
@@ -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 {
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index bd9f3f3c3ea..e14f1036912 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -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()) {
OpenPOWER on IntegriCloud