[llvm] [RISCV] Add a test for multiple save locations of a CSR. (PR #164479)
Mikhail Gudim via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 21 14:10:26 PDT 2025
https://github.com/mgudim updated https://github.com/llvm/llvm-project/pull/164479
>From 4f5d8e082547b285b619839e3797c84e01bc2aa2 Mon Sep 17 00:00:00 2001
From: Mikhail Gudim <mgudim at ventanamicro.com>
Date: Wed, 2 Apr 2025 08:22:37 -0700
Subject: [PATCH] [RISCV] Add a test for multiple save locations of a CSR.
Technically, it is possible that the a callee-saved register is saved
in different locations. CFIInstrInserter should handle this, but
currently it does not.
---
.../CodeGen/RISCV/cfi-multiple-locations.mir | 35 +++++++++++++++++++
1 file changed, 35 insertions(+)
create mode 100644 llvm/test/CodeGen/RISCV/cfi-multiple-locations.mir
diff --git a/llvm/test/CodeGen/RISCV/cfi-multiple-locations.mir b/llvm/test/CodeGen/RISCV/cfi-multiple-locations.mir
new file mode 100644
index 0000000000000..075536e10bce6
--- /dev/null
+++ b/llvm/test/CodeGen/RISCV/cfi-multiple-locations.mir
@@ -0,0 +1,35 @@
+# RUN: llc %s -mtriple=riscv64 \
+# RUN: -run-pass=cfi-instr-inserter \
+# RUN: -riscv-enable-cfi-instr-inserter=true
+# XFAIL: *
+
+# Technically, it is possible that the a callee-saved register is saved in different locations.
+# CFIInstrInserter should handle this, but currently it does not.
+---
+name: multiple_locations
+tracksRegLiveness: true
+body: |
+ bb.0.entry:
+ liveins: $x10, $x9, $x2
+ BEQ $x10, $x0, %bb.3
+ PseudoBR %bb.2
+
+ bb.1:
+ liveins: $x10, $x9, $x2
+ $x5 = COPY $x9
+ CFI_INSTRUCTION register $x9, $x5
+ $x9 = COPY $x5
+ CFI_INSTRUCTION register $x9, $x9
+ PseudoBR %bb.3
+
+ bb.2:
+ liveins: $x10, $x9, $x2
+ SD $x9, $x2, 0 :: (store (s64))
+ CFI_INSTRUCTION offset $x9, 0
+ $x9 = LD $x2, 0 :: (load (s64))
+ CFI_INSTRUCTION register $x9, $x9
+ PseudoBR %bb.3
+
+ bb.3:
+ PseudoRET
+...
More information about the llvm-commits
mailing list