diff options
Diffstat (limited to 'llvm/lib/Target/AArch64/AArch64FastISel.cpp')
-rw-r--r-- | llvm/lib/Target/AArch64/AArch64FastISel.cpp | 8 |
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()) |