Skip to content

Commit bb6603f

Browse files
[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
1 parent 07af106 commit bb6603f

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12379,6 +12379,9 @@ static SDValue performPostLD1Combine(SDNode *N,
1237912379
SelectionDAG &DAG = DCI.DAG;
1238012380
EVT VT = N->getValueType(0);
1238112381

12382+
if (VT.isScalableVector())
12383+
return SDValue();
12384+
1238212385
unsigned LoadIdx = IsLaneOp ? 1 : 0;
1238312386
SDNode *LD = N->getOperand(LoadIdx).getNode();
1238412387
// If it is not LOAD, can not do such combine.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2+
; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
3+
4+
; These tests are here to ensure we don't get a selection error caused
5+
; by performPostLD1Combine, which should bail out if the return
6+
; type is a scalable vector
7+
8+
define <vscale x 4 x i32> @test_post_ld1_insert(i32* %a, i32** %ptr, i64 %inc) {
9+
; CHECK-LABEL: test_post_ld1_insert:
10+
; CHECK: // %bb.0:
11+
; CHECK-NEXT: ldr w8, [x0]
12+
; CHECK-NEXT: add x9, x0, x2, lsl #2
13+
; CHECK-NEXT: str x9, [x1]
14+
; CHECK-NEXT: fmov s0, w8
15+
; CHECK-NEXT: ret
16+
%load = load i32, i32* %a
17+
%ins = insertelement <vscale x 4 x i32> undef, i32 %load, i32 0
18+
%gep = getelementptr i32, i32* %a, i64 %inc
19+
store i32* %gep, i32** %ptr
20+
ret <vscale x 4 x i32> %ins
21+
}
22+
23+
define <vscale x 2 x double> @test_post_ld1_dup(double* %a, double** %ptr, i64 %inc) {
24+
; CHECK-LABEL: test_post_ld1_dup:
25+
; CHECK: // %bb.0:
26+
; CHECK-NEXT: ldr d0, [x0]
27+
; CHECK-NEXT: add x8, x0, x2, lsl #3
28+
; CHECK-NEXT: mov z0.d, d0
29+
; CHECK-NEXT: str x8, [x1]
30+
; CHECK-NEXT: ret
31+
%load = load double, double* %a
32+
%dup = call <vscale x 2 x double> @llvm.aarch64.sve.dup.x.nxv2f64(double %load)
33+
%gep = getelementptr double, double* %a, i64 %inc
34+
store double* %gep, double** %ptr
35+
ret <vscale x 2 x double> %dup
36+
}
37+
38+
declare <vscale x 2 x double> @llvm.aarch64.sve.dup.x.nxv2f64(double)

0 commit comments

Comments
 (0)