summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/AArch64/AArch64FastISel.cpp
diff options
context:
space:
mode:
authorEduard Burtescu <edy.burt@gmail.com>2016-01-19 17:28:00 +0000
committerEduard Burtescu <edy.burt@gmail.com>2016-01-19 17:28:00 +0000
commit19eb03106d6042a404f4943f3e9efc74da6865f6 (patch)
tree77adf285682b322cf27b5955635970a6a0a332dc /llvm/lib/Target/AArch64/AArch64FastISel.cpp
parentd9cac592f444c84b63797019975aefbac20e1985 (diff)
downloadbcm5719-llvm-19eb03106d6042a404f4943f3e9efc74da6865f6.tar.gz
bcm5719-llvm-19eb03106d6042a404f4943f3e9efc74da6865f6.zip
[opaque pointer types] [NFC] GEP: replace get(Pointer)ElementType uses with get{Source,Result}ElementType.
Summary: GEPOperator: provide getResultElementType alongside getSourceElementType. This is made possible by adding a result element type field to GetElementPtrConstantExpr, which GetElementPtrInst already has. GEP: replace get(Pointer)ElementType uses with get{Source,Result}ElementType. Reviewers: mjacob, dblaikie Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D16275 llvm-svn: 258145
Diffstat (limited to 'llvm/lib/Target/AArch64/AArch64FastISel.cpp')
-rw-r--r--llvm/lib/Target/AArch64/AArch64FastISel.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64FastISel.cpp b/llvm/lib/Target/AArch64/AArch64FastISel.cpp
index 0ac4b39b035..1e4be55aee6 100644
--- a/llvm/lib/Target/AArch64/AArch64FastISel.cpp
+++ b/llvm/lib/Target/AArch64/AArch64FastISel.cpp
@@ -4825,7 +4825,13 @@ bool AArch64FastISel::selectGetElementPtr(const Instruction *I) {
TotalOffs += DL.getStructLayout(StTy)->getElementOffset(Field);
Ty = StTy->getElementType(Field);
} else {
- Ty = cast<SequentialType>(Ty)->getElementType();
+ if (Ty->isPointerTy()) {
+ // The only pointer type is for the very first index,
+ // therefore the next type is the source element type.
+ Ty = cast<GEPOperator>(I)->getSourceElementType();
+ } else {
+ Ty = cast<SequentialType>(Ty)->getElementType();
+ }
// If this is a constant subscript, handle it quickly.
if (const auto *CI = dyn_cast<ConstantInt>(Idx)) {
if (CI->isZero())
OpenPOWER on IntegriCloud