[PATCH] D84884: [SelectionDAG] Fix lowering of vector geps
Jon Roelofs via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 29 12:18:32 PDT 2020
jroelofs created this revision.
jroelofs added reviewers: aemerson, t.p.northover.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
jroelofs requested review of this revision.
This fixes an assertion failure that was being triggered in SelectionDAG::getZeroExtendInReg(), where it was trying to extend the <2xi32> to i64 (which should have been <2xi64>).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D84884
Files:
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/test/CodeGen/AArch64/vector-gep.ll
Index: llvm/test/CodeGen/AArch64/vector-gep.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AArch64/vector-gep.ll
@@ -0,0 +1,21 @@
+; RUN: llc < %s -mtriple=arm64_32-apple-watchos2.0.0 --aarch64-neon-syntax=generic | FileCheck %s
+
+target datalayout = "e-m:o-p:32:32-i64:64-i128:128-n32:64-S128"
+target triple = "arm64_32-apple-watchos2.0.0"
+
+; CHECK-LABEL: lCPI0_0:
+; CHECK-NEXT: .quad 36
+; CHECK-NEXT: .quad 4804
+
+define <2 x i8*> @vector_gep(<2 x i8*> %0) {
+; CHECK-LABEL: vector_gep:
+; CHECK: adrp x[[REG8:[123]?[0-9]]], lCPI0_0 at PAGE
+; CHECK: ldr q[[REG1:[0-9]+]], [x[[REG8]], lCPI0_0 at PAGEOFF]
+; CHECK: add v[[REG0:[0-9]+]].2d, v[[REG0]].2d, v[[REG1]].2d
+; CHECK: movi v[[REG1]].2d, #0x000000ffffffff
+; CHECK: and v[[REG0]].16b, v[[REG0]].16b, v[[REG1]].16b
+; CHECK: ret
+entry:
+ %1 = getelementptr i8, <2 x i8*> %0, <2 x i32> <i32 36, i32 4804>
+ ret <2 x i8*> %1
+}
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -3753,8 +3753,6 @@
SDValue N = getValue(Op0);
SDLoc dl = getCurSDLoc();
auto &TLI = DAG.getTargetLoweringInfo();
- MVT PtrTy = TLI.getPointerTy(DAG.getDataLayout(), AS);
- MVT PtrMemTy = TLI.getPointerMemTy(DAG.getDataLayout(), AS);
// Normalize Vector GEP - all scalar operands should be converted to the
// splat vector.
@@ -3880,6 +3878,13 @@
}
}
+ MVT PtrTy = TLI.getPointerTy(DAG.getDataLayout(), AS);
+ MVT PtrMemTy = TLI.getPointerMemTy(DAG.getDataLayout(), AS);
+ if (IsVectorGEP) {
+ PtrTy = MVT::getVectorVT(PtrTy, VectorElementCount);
+ PtrMemTy = MVT::getVectorVT(PtrMemTy, VectorElementCount);
+ }
+
if (PtrMemTy != PtrTy && !cast<GEPOperator>(I).isInBounds())
N = DAG.getPtrExtendInReg(N, dl, PtrMemTy);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84884.281703.patch
Type: text/x-patch
Size: 2018 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200729/dc58a18d/attachment.bin>
More information about the llvm-commits
mailing list