Stage 2 llvm backend, improve code gen for return values #9581
Labels
backend-llvm
The LLVM backend outputs an LLVM IR Module.
enhancement
Solving this issue will likely involve adding new logic or components to the codebase.
frontend
Tokenization, parsing, AstGen, Sema, and Liveness.
optimization
Milestone
Currently the ABI for passing optional and error parameters prevent full optimization by LLVM.
Sub optimal code generation with full optimization when using
catch |...|
https://godbolt.org/z/xqTKWKW37
Optimal code generation with full optimization when performing essentially the same but using
catch 1
https://godbolt.org/z/PWe4GPb3c
For Optional, both variants produce sub optimal code:
https://godbolt.org/z/qGavK9aWK
Note that Swift has a similar strategy (passing a struct), but manages to get better optimization:
https://godbolt.org/z/4xa5Y85Gx
The text was updated successfully, but these errors were encountered: