[llvm] [RISCV][GISel] Don't custom legalize load/store of vector of pointers if ELEN < XLEN. (PR #101565)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 13 14:42:29 PDT 2024


https://github.com/topperc updated https://github.com/llvm/llvm-project/pull/101565

>From 46e50cd76f7eb0c9f9cb07aa6a1641420d46e4a1 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Thu, 1 Aug 2024 14:55:14 -0700
Subject: [PATCH] [RISCV][GISel] Don't custom legalize load/store of vector of
 pointers if ELEN < XLEN.

We need to have elements than can hold a pointer sized element.

No test because it crashes in LowerLoad or LowerStore now which
needs to be addressed separately.
---
 llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp b/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
index ad36f822accefe..74bfe8b838af77 100644
--- a/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
+++ b/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
@@ -330,9 +330,11 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST)
 
     // we will take the custom lowering logic if we have scalable vector types
     // with non-standard alignments
-    LoadStoreActions.customIf(
-          LegalityPredicates::any(typeIsLegalIntOrFPVec(0, IntOrFPVecTys, ST),
-                                  typeIsLegalPtrVec(0, PtrVecTys, ST)));
+    LoadStoreActions.customIf(typeIsLegalIntOrFPVec(0, IntOrFPVecTys, ST));
+
+    // Pointers require that XLen sized elements are legal.
+    if (XLen <= ST.getELen())
+      LoadStoreActions.customIf(typeIsLegalPtrVec(0, PtrVecTys, ST));
   }
 
   LoadStoreActions.widenScalarToNextPow2(0, /* MinSize = */ 8)



More information about the llvm-commits mailing list