Skip to content

Commit c772f5d

Browse files
authored
[RISCV] Disable fixed vectors in getOptimalMemOpType if minimum VLEN is 32. (#102974)
This is needed to match #102405 which disabled fixed to scalable vector lowering for VLEN=32. Fixes #102566 and #102568.
1 parent 136e5f4 commit c772f5d

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21024,6 +21024,11 @@ EVT RISCVTargetLowering::getOptimalMemOpType(const MemOp &Op,
2102421024
// which ends up using scalar sequences.
2102521025
return MVT::Other;
2102621026

21027+
// If the minimum VLEN is less than RISCV::RVVBitsPerBlock we don't support
21028+
// fixed vectors.
21029+
if (MinVLenInBytes <= RISCV::RVVBitsPerBlock / 8)
21030+
return MVT::Other;
21031+
2102721032
// Prefer i8 for non-zero memset as it allows us to avoid materializing
2102821033
// a large scalar constant and instead use vmv.v.x/i to do the
2102921034
// broadcast. For everything else, prefer ELenVT to minimize VL and thus
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2+
; RUN: llc < %s -mtriple=riscv64 -mattr=+zve32x | FileCheck %s
3+
4+
; Make sure we don't with VLEN=32.
5+
6+
define void @c() {
7+
; CHECK-LABEL: c:
8+
; CHECK: # %bb.0: # %entry
9+
; CHECK-NEXT: lw a0, 0(zero)
10+
; CHECK-NEXT: sw a0, 0(zero)
11+
; CHECK-NEXT: ret
12+
entry:
13+
call void @llvm.memcpy.p0.p0.i64(ptr null, ptr null, i64 4, i1 false)
14+
ret void
15+
}
16+
17+
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

0 commit comments

Comments
 (0)