From 616dfef086e8f22d29c06c23420a649fcc34c04c Mon Sep 17 00:00:00 2001
From: Matthew Pickering <matthewtpickering@gmail.com>
Date: Mon, 30 Sep 2024 13:44:08 +0100
Subject: [PATCH] Fix registerArch for riscv64

The register allocator doesn't support vector registers on riscv64,
therefore advertise as NoVectors.

Fixes #25314

(cherry picked from commit af59749abb723283fa42b51f62a8ac8b345a7f8f)
---
 compiler/GHC/Platform/Reg/Class.hs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/compiler/GHC/Platform/Reg/Class.hs b/compiler/GHC/Platform/Reg/Class.hs
index e76f8af036a..23b3c24b2a5 100644
--- a/compiler/GHC/Platform/Reg/Class.hs
+++ b/compiler/GHC/Platform/Reg/Class.hs
@@ -49,5 +49,8 @@ registerArch arch =
     ArchPPC       -> Unified
     ArchPPC_64 {} -> Unified
     ArchAArch64   -> Unified
-    ArchRISCV64   -> Separate
+    -- Support for vector registers not yet implemented for RISC-V
+    -- see panic in `getFreeRegs`.
+    --ArchRISCV64   -> Separate
+    ArchRISCV64   -> NoVectors
     _             -> NoVectors
-- 
GitLab