[llvm] b675c0c - [RISCV] Add a test for multiple save locations of a callee-saved register (#164479)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 5 05:05:47 PST 2025
Author: Mikhail Gudim
Date: 2025-11-05T08:05:43-05:00
New Revision: b675c0c498e45057537194c564ad3d3f18f229dd
URL: https://github.com/llvm/llvm-project/commit/b675c0c498e45057537194c564ad3d3f18f229dd
DIFF: https://github.com/llvm/llvm-project/commit/b675c0c498e45057537194c564ad3d3f18f229dd.diff
LOG: [RISCV] Add a test for multiple save locations of a callee-saved register (#164479)
Technically, it is possible that the a callee-saved register is saved in
different locations. CFIInstrInserter should handle this, but currently
it does not.
Added:
llvm/test/CodeGen/RISCV/cfi-multiple-locations.mir
Modified:
Removed:
################################################################################
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..7844589e3f93c
--- /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 a callee-saved register is saved in multiple
diff erent 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