[llvm] [CodeGen] Refactor `determineCalleeSaves`. (PR #166763)

via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 12 07:18:03 PDT 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Linux-->
# :penguin: Linux x64 Test Results

* 171172 tests passed
* 3031 tests skipped
* 2 tests failed

## Failed Tests
(click on a test name to see its output)

### LLVM
<details>
<summary>LLVM.CodeGen/RISCV/determine-callee-saves-uncond.mir</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 3
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/determine-callee-saves-uncond.mir -mtriple=riscv64 -run-pass=prologepilog  --riscv-save-csrs-early=false  -o - | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/determine-callee-saves-uncond.mir  -check-prefixes=NOEARLYCSR_UNCONDX19
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/determine-callee-saves-uncond.mir -mtriple=riscv64 -run-pass=prologepilog --riscv-save-csrs-early=false -o -
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/determine-callee-saves-uncond.mir -check-prefixes=NOEARLYCSR_UNCONDX19
# note: command had no output on stdout or stderr
# RUN: at line 7
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/determine-callee-saves-uncond.mir -mtriple=riscv64 -run-pass=prologepilog  --riscv-save-csrs-early=true  -o - | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/determine-callee-saves-uncond.mir -check-prefixes=EARLYCSR_UNCONDX19-
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/determine-callee-saves-uncond.mir -mtriple=riscv64 -run-pass=prologepilog --riscv-save-csrs-early=true -o -
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/determine-callee-saves-uncond.mir -check-prefixes=EARLYCSR_UNCONDX19-
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/determine-callee-saves-uncond.mir:61:25: error: EARLYCSR_UNCONDX19-: expected string not found in input
# |  ; EARLYCSR_UNCONDX19-: liveins: $x10, $x19
# |                         ^
# | <stdin>:29:23: note: scanning from here
# | name: use_callee_saved
# |                       ^
# | <stdin>:93:2: note: possible intended match here
# |  liveins: $x10, $x18, $x19
# |  ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/determine-callee-saves-uncond.mir:138:25: error: EARLYCSR_UNCONDX19-: expected string not found in input
# |  ; EARLYCSR_UNCONDX19-: liveins: $x19
# |                         ^
# | <stdin>:182:39: note: scanning from here
# | name: make_a_call_and_use_callee_saved
# |                                       ^
# | <stdin>:246:2: note: possible intended match here
# |  liveins: $x18, $x19
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/determine-callee-saves-uncond.mir
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |              .
# |              .
# |              .
# |             24:  declare void @bar(...) 
# |             25:   
# |             26:  attributes #0 = { "riscv-user-defined-uncond-prolog-csrs"="x19" } 
# |             27: ... 
# |             28: --- 
# |             29: name: use_callee_saved 
# | check:61'0                            X error: no match found
# |             30: alignment: 1 
# | check:61'0      ~~~~~~~~~~~~~
# |             31: exposesReturnsTwice: false 
# | check:61'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             32: legalized: false 
# | check:61'0      ~~~~~~~~~~~~~~~~~
# |             33: regBankSelected: false 
# | check:61'0      ~~~~~~~~~~~~~~~~~~~~~~~
# |             34: selected: false 
# | check:61'0      ~~~~~~~~~~~~~~~~
# |              .
# |              .
# |              .
# |             88: machineFunctionInfo: 
# | check:61'0      ~~~~~~~~~~~~~~~~~~~~~
# |             89:  varArgsFrameIndex: 0 
# | check:61'0      ~~~~~~~~~~~~~~~~~~~~~~
# |             90:  varArgsSaveSize: 0 
# | check:61'0      ~~~~~~~~~~~~~~~~~~~~
# |             91: body: | 
# | check:61'0      ~~~~~~~~
# |             92:  bb.0.entry: 
# | check:61'0      ~~~~~~~~~~~~~
# |             93:  liveins: $x10, $x18, $x19 
# | check:61'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:61'1       ?                          possible intended match
# |             94:   
# | check:61'0      ~~
# |             95:  $x2 = frame-setup ADDI $x2, -32 
# | check:61'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             96:  frame-setup CFI_INSTRUCTION def_cfa_offset 32 
# | check:61'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             97:  frame-setup SD killed $x18, $x2, 24 :: (store (s64) into %stack.1) 
# | check:61'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             98:  frame-setup SD killed $x19, $x2, 16 :: (store (s64) into %stack.2) 
# | check:61'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |              .
# |              .
# |              .
# |            177:  $x2 = frame-destroy ADDI $x2, 16 
# |            178:  frame-destroy CFI_INSTRUCTION def_cfa_offset 0 
# |            179:  PseudoTAIL target-flags(riscv-call) @bar, csr_ilp32d_lp64d, implicit $x2 
# |            180: ... 
# |            181: --- 
# |            182: name: make_a_call_and_use_callee_saved 
# | check:138'0                                           X error: no match found
# |            183: alignment: 1 
# | check:138'0     ~~~~~~~~~~~~~
# |            184: exposesReturnsTwice: false 
# | check:138'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            185: legalized: false 
# | check:138'0     ~~~~~~~~~~~~~~~~~
# |            186: regBankSelected: false 
# | check:138'0     ~~~~~~~~~~~~~~~~~~~~~~~
# |            187: selected: false 
# | check:138'0     ~~~~~~~~~~~~~~~~
# |              .
# |              .
# |              .
# |            241: machineFunctionInfo: 
# | check:138'0     ~~~~~~~~~~~~~~~~~~~~~
# |            242:  varArgsFrameIndex: 0 
# | check:138'0     ~~~~~~~~~~~~~~~~~~~~~~
# |            243:  varArgsSaveSize: 0 
# | check:138'0     ~~~~~~~~~~~~~~~~~~~~
# |            244: body: | 
# | check:138'0     ~~~~~~~~
# |            245:  bb.0.entry: 
# | check:138'0     ~~~~~~~~~~~~~
# |            246:  liveins: $x18, $x19 
# | check:138'0     ~~~~~~~~~~~~~~~~~~~~~
# | check:138'1      ?                    possible intended match
# |            247:   
# | check:138'0     ~~
# |            248:  $x2 = frame-setup ADDI $x2, -32 
# | check:138'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            249:  frame-setup CFI_INSTRUCTION def_cfa_offset 32 
# | check:138'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            250:  frame-setup SD killed $x18, $x2, 24 :: (store (s64) into %stack.1) 
# | check:138'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            251:  frame-setup SD killed $x19, $x2, 16 :: (store (s64) into %stack.2) 
# | check:138'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |              .
# |              .
# |              .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>
<details>
<summary>LLVM.CodeGen/RISCV/determine-callee-saves.mir</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 3
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/determine-callee-saves.mir -mtriple=riscv64 -run-pass=prologepilog  --riscv-save-csrs-early=false  -o - | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/determine-callee-saves.mir  -check-prefixes=NOEARLYCSR
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/determine-callee-saves.mir -mtriple=riscv64 -run-pass=prologepilog --riscv-save-csrs-early=false -o -
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/determine-callee-saves.mir -check-prefixes=NOEARLYCSR
# note: command had no output on stdout or stderr
# RUN: at line 7
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/determine-callee-saves.mir -mtriple=riscv64 -run-pass=prologepilog  --riscv-save-csrs-early=true  -o - | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/determine-callee-saves.mir -check-prefixes=EARLYCSR
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/determine-callee-saves.mir -mtriple=riscv64 -run-pass=prologepilog --riscv-save-csrs-early=true -o -
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/determine-callee-saves.mir -check-prefixes=EARLYCSR
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/determine-callee-saves.mir:60:19: error: EARLYCSR-NEXT: expected string not found in input
# |  ; EARLYCSR-NEXT: $x18 = LD $x2, 8 :: (load (s64))
# |                   ^
# | <stdin>:91:47: note: scanning from here
# |  frame-setup CFI_INSTRUCTION def_cfa_offset 16
# |                                               ^
# | <stdin>:94:2: note: possible intended match here
# |  $x18 = LD $x2, 0 :: (load (s64))
# |  ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/determine-callee-saves.mir:107:19: error: EARLYCSR-NEXT: expected string not found in input
# |  ; EARLYCSR-NEXT: $x18 = LD $x2, 8 :: (load (s64))
# |                   ^
# | <stdin>:224:47: note: scanning from here
# |  frame-setup CFI_INSTRUCTION def_cfa_offset 16
# |                                               ^
# | <stdin>:227:2: note: possible intended match here
# |  $x18 = LD $x2, 0 :: (load (s64))
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/determine-callee-saves.mir
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |            86: body: | 
# |            87:  bb.0.entry: 
# |            88:  liveins: $x10, $x18 
# |            89:   
# |            90:  $x2 = frame-setup ADDI $x2, -16 
# |            91:  frame-setup CFI_INSTRUCTION def_cfa_offset 16 
# | next:60'0                                                    X error: no match found
# |            92:  frame-setup SD killed $x18, $x2, 8 :: (store (s64) into %stack.1) 
# | next:60'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            93:  frame-setup CFI_INSTRUCTION offset $x18, -8 
# | next:60'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            94:  $x18 = LD $x2, 0 :: (load (s64)) 
# | next:60'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:60'1       ?                                 possible intended match
# |            95:  $x18 = frame-destroy LD $x2, 8 :: (load (s64) from %stack.1) 
# | next:60'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            96:  frame-destroy CFI_INSTRUCTION restore $x18 
# | next:60'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            97:  $x2 = frame-destroy ADDI $x2, 16 
# | next:60'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            98:  frame-destroy CFI_INSTRUCTION def_cfa_offset 0 
# | next:60'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            99:  PseudoRET 
# | next:60'0      ~~~~~~~~~~~
# |             .
# |             .
# |             .
# |           219: body: | 
# |           220:  bb.0.entry: 
# |           221:  liveins: $x18 
# |           222:   
# |           223:  $x2 = frame-setup ADDI $x2, -16 
# |           224:  frame-setup CFI_INSTRUCTION def_cfa_offset 16 
# | next:107'0                                                   X error: no match found
# |           225:  frame-setup SD killed $x18, $x2, 8 :: (store (s64) into %stack.1) 
# | next:107'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           226:  frame-setup CFI_INSTRUCTION offset $x18, -8 
# | next:107'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           227:  $x18 = LD $x2, 0 :: (load (s64)) 
# | next:107'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:107'1      ?                                 possible intended match
# |           228:  $x18 = frame-destroy LD $x2, 8 :: (load (s64) from %stack.1) 
# | next:107'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           229:  frame-destroy CFI_INSTRUCTION restore $x18 
# | next:107'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           230:  $x2 = frame-destroy ADDI $x2, 16 
# | next:107'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           231:  frame-destroy CFI_INSTRUCTION def_cfa_offset 0 
# | next:107'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           232:  PseudoTAIL target-flags(riscv-call) @bar, csr_ilp32d_lp64d, implicit $x2 
# | next:107'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           233: ... 
# | next:107'0     ~~~~
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

https://github.com/llvm/llvm-project/pull/166763


More information about the llvm-commits mailing list