noreturn functions save registers #23952
Labels
backend-llvm
The LLVM backend outputs an LLVM IR Module.
bug
Observed behavior contradicts documented or intended behavior
optimization
upstream
An issue with a third party project that Zig uses.
Milestone
Uh oh!
There was an error while loading. Please reload this page.
Zig Version
0.15.0-dev.558+9279ff888
Steps to Reproduce and Observed Behavior
Compile a function with a return type of
noreturn
. The generated code saves various registers.Tested on compiler for rp2350 arm and riscv.
Expected Behavior
noreturn
functions should not save registers.Since the function cannot return, there is no reason to save existing registers, so doing so just wastes stack space. This is especially a problem when writing code for small embedded processors or other situation where stack space is at a premium.
The text was updated successfully, but these errors were encountered: