Skip to content

Conversation

@mgudim
Copy link
Contributor

@mgudim mgudim commented Nov 20, 2025

(1) Define CSRSavedLocation::Kind and use it in the code. This makes the code more readable and allows to extend it to new kinds. For example, soon I want to add "scalable offset from a given register" kind.

(2) Store the contents in a union. This should reduce memory usage.

(1) Define `CSRSavedLocation::Kind` and use it in the code. This makes
the code more readable and allows to extend it to new kinds. For
example, soon I want to add "scalable offset from a given register"
kind.

(2) Store the contents in a union. This should reduce memory usage.
@github-actions
Copy link

🐧 Linux x64 Test Results

  • 133031 tests passed
  • 2365 tests skipped
  • 3 tests failed

Failed Tests

(click on a test name to see its output)

LLVM

LLVM.CodeGen/Generic/2006-03-01-dagcombineinfloop.ll
Exit Code: -6

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/Generic/2006-03-01-dagcombineinfloop.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc
# .---command stderr------------
# | llc: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/CFIInstrInserter.cpp:129: int64_t (anonymous namespace)::CFIInstrInserter::CSRSavedLocation::getOffset() const: Assertion `K == Register' failed.
# | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
# | Stack dump:
# | 0.	Program arguments: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc
# | 1.	Running pass 'Function Pass Manager' on module '<stdin>'.
# | 2.	Running pass 'Check CFA info and insert CFI instructions if needed' on function '@self_promoting_args_p'
# |  #0 0x0000000007edf198 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:834:13
# |  #1 0x0000000007edc8a5 llvm::sys::RunSignalHandlers() /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Signals.cpp:105:18
# |  #2 0x0000000007edff61 SignalHandler(int, siginfo_t*, void*) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:426:38
# |  #3 0x00007897c3c86330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
# |  #4 0x00007897c3cdfb2c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9eb2c)
# |  #5 0x00007897c3c8627e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
# |  #6 0x00007897c3c698ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
# |  #7 0x00007897c3c6981b (/lib/x86_64-linux-gnu/libc.so.6+0x2881b)
# |  #8 0x00007897c3c7c517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
# |  #9 0x0000000006ced9d9 apply<(lambda at /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/CFIInstrInserter.cpp:355:20), llvm::BitVector, llvm::BitVector> /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/BitVector.h:573:5
# | #10 0x0000000006ced9d9 calculateOutgoingCFAInfo /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/CFIInstrInserter.cpp:355:3
# | #11 0x0000000006ced9d9 updateSuccCFAInfo /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/CFIInstrInserter.cpp:367:5
# | #12 0x0000000006ced9d9 calculateCFAInfo /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/CFIInstrInserter.cpp:227:3
# | #13 0x0000000006ced9d9 (anonymous namespace)::CFIInstrInserter::runOnMachineFunction(llvm::MachineFunction&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/CFIInstrInserter.cpp:56:5
# | #14 0x0000000006ee1a23 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:0:10
# | #15 0x0000000007450185 llvm::FPPassManager::runOnFunction(llvm::Function&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1398:27
# | #16 0x0000000007458132 llvm::FPPassManager::runOnModule(llvm::Module&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1444:13
# | #17 0x0000000007450c2c runOnModule /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1513:27
# | #18 0x0000000007450c2c llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:531:44
# | #19 0x0000000004db4308 compileModule(char**, llvm::LLVMContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/tools/llc/llc.cpp:0:8
# | #20 0x0000000004db16a0 main /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/tools/llc/llc.cpp:451:13
# | #21 0x00007897c3c6b1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
# | #22 0x00007897c3c6b28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
# | #23 0x0000000004dad125 _start (/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc+0x4dad125)
# `-----------------------------
# error: command failed with exit status: -6

--

LLVM.CodeGen/X86/cfi-inserter-callee-save-register-2.mir
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -o - /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/cfi-inserter-callee-save-register-2.mir -mtriple=x86_64-- -verify-cfiinstrs      -run-pass=cfi-instr-inserter 2>&1 | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/cfi-inserter-callee-save-register-2.mir
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -o - /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/cfi-inserter-callee-save-register-2.mir -mtriple=x86_64-- -verify-cfiinstrs -run-pass=cfi-instr-inserter
# note: command had no output on stdout or stderr
# error: command failed with exit status: -6
# 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/X86/cfi-inserter-callee-save-register-2.mir
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/cfi-inserter-callee-save-register-2.mir:11:10: error: CHECK: expected string not found in input
# | # CHECK: bb.3:
# |          ^
# | <stdin>:1:1: note: scanning from here
# | llc: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/CFIInstrInserter.cpp:129: int64_t (anonymous namespace)::CFIInstrInserter::CSRSavedLocation::getOffset() const: Assertion `K == Register' failed.
# | ^
# | <stdin>:2:43: note: possible intended match here
# | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
# |                                           ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/cfi-inserter-callee-save-register-2.mir
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             1: llc: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/CFIInstrInserter.cpp:129: int64_t (anonymous namespace)::CFIInstrInserter::CSRSavedLocation::getOffset() const: Assertion `K == Register' failed. 
# | check:11'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
# |             2: PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug. 
# | check:11'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:11'1                                               ?                                                                                                        possible intended match
# |             3: Stack dump: 
# | check:11'0     ~~~~~~~~~~~~
# |             4: 0. Program arguments: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -o - /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/cfi-inserter-callee-save-register-2.mir -mtriple=x86_64-- -verify-cfiinstrs -run-pass=cfi-instr-inserter 
# | check:11'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             5: 1. Running pass 'Function Pass Manager' on module '/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/cfi-inserter-callee-save-register-2.mir'. 
# | check:11'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             6: 2. Running pass 'Check CFA info and insert CFI instructions if needed' on function '@foo' 
# | check:11'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             7:  #0 0x0000000007edf198 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:834:13 
# | check:11'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

LLVM.CodeGen/X86/cfi-inserter-verify-inconsistent-loc.mir
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
not --crash /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -o - /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/cfi-inserter-verify-inconsistent-loc.mir -mtriple=x86_64--      -run-pass=cfi-instr-inserter 2>&1 | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/cfi-inserter-verify-inconsistent-loc.mir
# executed command: not --crash /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -o - /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/cfi-inserter-verify-inconsistent-loc.mir -mtriple=x86_64-- -run-pass=cfi-instr-inserter
# 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/X86/cfi-inserter-verify-inconsistent-loc.mir
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/cfi-inserter-verify-inconsistent-loc.mir:12:10: error: CHECK: expected string not found in input
# | # CHECK: LLVM ERROR: Different saved locations for the same CSR
# |          ^
# | <stdin>:1:1: note: scanning from here
# | llc: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/CFIInstrInserter.cpp:129: int64_t (anonymous namespace)::CFIInstrInserter::CSRSavedLocation::getOffset() const: Assertion `K == Register' failed.
# | ^
# | <stdin>:1:134: note: possible intended match here
# | llc: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/CFIInstrInserter.cpp:129: int64_t (anonymous namespace)::CFIInstrInserter::CSRSavedLocation::getOffset() const: Assertion `K == Register' failed.
# |                                                                                                                                      ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/cfi-inserter-verify-inconsistent-loc.mir
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             1: llc: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/CFIInstrInserter.cpp:129: int64_t (anonymous namespace)::CFIInstrInserter::CSRSavedLocation::getOffset() const: Assertion `K == Register' failed. 
# | check:12'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
# | check:12'1                                                                                                                                          ?                                                                                            possible intended match
# |             2: PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug. 
# | check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             3: Stack dump: 
# | check:12'0     ~~~~~~~~~~~~
# |             4: 0. Program arguments: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -o - /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/cfi-inserter-verify-inconsistent-loc.mir -mtriple=x86_64-- -run-pass=cfi-instr-inserter 
# | check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             5: 1. Running pass 'Function Pass Manager' on module '/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/cfi-inserter-verify-inconsistent-loc.mir'. 
# | check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             6: 2. Running pass 'Check CFA info and insert CFI instructions if needed' on function '@inconsistentlocs' 
# | check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants