[llvm] bb6603f - [AArch64][SVE] Bail out of performPostLD1Combine for scalable types
Kerry McLaughlin via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 29 04:28:08 PDT 2020
Author: Kerry McLaughlin
Date: 2020-06-29T11:59:53+01:00
New Revision: bb6603f0132b4e42633d1402076acfa634c034e0
URL: https://github.com/llvm/llvm-project/commit/bb6603f0132b4e42633d1402076acfa634c034e0
DIFF: https://github.com/llvm/llvm-project/commit/bb6603f0132b4e42633d1402076acfa634c034e0.diff
LOG: [AArch64][SVE] Bail out of performPostLD1Combine for scalable types
Summary:
performPostLD1Combine will introduce either a LD1LANEpost
or LD1DUPpost node, which will cause selection failure if the
return type is a scalable vector.
Reviewers: sdesmalen, c-rhodes, efriedma
Reviewed By: efriedma
Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, danielkiss, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82670
Added:
llvm/test/CodeGen/AArch64/sve-ld-post-inc.ll
Modified:
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index 71df3c641973..f0a732e9237d 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -12379,6 +12379,9 @@ static SDValue performPostLD1Combine(SDNode *N,
SelectionDAG &DAG = DCI.DAG;
EVT VT = N->getValueType(0);
+ if (VT.isScalableVector())
+ return SDValue();
+
unsigned LoadIdx = IsLaneOp ? 1 : 0;
SDNode *LD = N->getOperand(LoadIdx).getNode();
// If it is not LOAD, can not do such combine.
diff --git a/llvm/test/CodeGen/AArch64/sve-ld-post-inc.ll b/llvm/test/CodeGen/AArch64/sve-ld-post-inc.ll
new file mode 100644
index 000000000000..d0b65768b96f
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/sve-ld-post-inc.ll
@@ -0,0 +1,38 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
+
+; These tests are here to ensure we don't get a selection error caused
+; by performPostLD1Combine, which should bail out if the return
+; type is a scalable vector
+
+define <vscale x 4 x i32> @test_post_ld1_insert(i32* %a, i32** %ptr, i64 %inc) {
+; CHECK-LABEL: test_post_ld1_insert:
+; CHECK: // %bb.0:
+; CHECK-NEXT: ldr w8, [x0]
+; CHECK-NEXT: add x9, x0, x2, lsl #2
+; CHECK-NEXT: str x9, [x1]
+; CHECK-NEXT: fmov s0, w8
+; CHECK-NEXT: ret
+ %load = load i32, i32* %a
+ %ins = insertelement <vscale x 4 x i32> undef, i32 %load, i32 0
+ %gep = getelementptr i32, i32* %a, i64 %inc
+ store i32* %gep, i32** %ptr
+ ret <vscale x 4 x i32> %ins
+}
+
+define <vscale x 2 x double> @test_post_ld1_dup(double* %a, double** %ptr, i64 %inc) {
+; CHECK-LABEL: test_post_ld1_dup:
+; CHECK: // %bb.0:
+; CHECK-NEXT: ldr d0, [x0]
+; CHECK-NEXT: add x8, x0, x2, lsl #3
+; CHECK-NEXT: mov z0.d, d0
+; CHECK-NEXT: str x8, [x1]
+; CHECK-NEXT: ret
+ %load = load double, double* %a
+ %dup = call <vscale x 2 x double> @llvm.aarch64.sve.dup.x.nxv2f64(double %load)
+ %gep = getelementptr double, double* %a, i64 %inc
+ store double* %gep, double** %ptr
+ ret <vscale x 2 x double> %dup
+}
+
+declare <vscale x 2 x double> @llvm.aarch64.sve.dup.x.nxv2f64(double)
More information about the llvm-commits
mailing list