From 4f5d8e082547b285b619839e3797c84e01bc2aa2 Mon Sep 17 00:00:00 2001 From: Mikhail Gudim Date: Wed, 2 Apr 2025 08:22:37 -0700 Subject: [PATCH 1/2] [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 +... From 677121d5237b7b6a199ca4a71c9e5b4cd59e7388 Mon Sep 17 00:00:00 2001 From: Mikhail Gudim Date: Tue, 21 Oct 2025 14:10:48 -0700 Subject: [PATCH 2/2] fixed a typo, improved wording. --- llvm/test/CodeGen/RISCV/cfi-multiple-locations.mir | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/test/CodeGen/RISCV/cfi-multiple-locations.mir b/llvm/test/CodeGen/RISCV/cfi-multiple-locations.mir index 075536e10bce6..7844589e3f93c 100644 --- a/llvm/test/CodeGen/RISCV/cfi-multiple-locations.mir +++ b/llvm/test/CodeGen/RISCV/cfi-multiple-locations.mir @@ -3,7 +3,7 @@ # RUN: -riscv-enable-cfi-instr-inserter=true # XFAIL: * -# Technically, it is possible that the a callee-saved register is saved in different locations. +# Technically, it is possible that a callee-saved register is saved in multiple different locations. # CFIInstrInserter should handle this, but currently it does not. --- name: multiple_locations