-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* cranelift: Always consider sret arguments used In #8438 we stopped emitting register bindings for unused arguments, based on the use-counts from `compute_use_states`. However, that doesn't count the use of the struct-return argument that's automatically added after lowering when the `rets` instruction is generated in the epilogue. As a result, using a struct-return argument caused register allocation to panic due to the VReg not being defined anywhere. This commit adds a use to the struct-return argument so that it's always available in the epilogue. Fixes #8659 * Review comments Co-authored-by: Jamey Sharp <[email protected]>
- Loading branch information
1 parent
1b38670
commit e882dd8
Showing
3 changed files
with
64 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
test compile precise-output | ||
target aarch64 | ||
|
||
function u0:11(i64 sret) system_v { | ||
block0(v0: i64): | ||
return | ||
} | ||
|
||
; VCode: | ||
; block0: | ||
; ret | ||
; | ||
; Disassembled: | ||
; block0: ; offset 0x0 | ||
; ret | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
test compile precise-output | ||
target x86_64 | ||
|
||
function u0:11(i64 sret) system_v { | ||
block0(v0: i64): | ||
return | ||
} | ||
|
||
; VCode: | ||
; pushq %rbp | ||
; movq %rsp, %rbp | ||
; block0: | ||
; movq %rdi, %rax | ||
; movq %rbp, %rsp | ||
; popq %rbp | ||
; ret | ||
; | ||
; Disassembled: | ||
; block0: ; offset 0x0 | ||
; pushq %rbp | ||
; movq %rsp, %rbp | ||
; block1: ; offset 0x4 | ||
; movq %rdi, %rax | ||
; movq %rbp, %rsp | ||
; popq %rbp | ||
; retq | ||
|