Remove an attempt to reserve a GPR when no GPR clobbering is occurring #2766
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a test for another regression introduced by 8f855cf. What happens here is that the
local.get 0
instructions reserve the relevant registers and when it comes a time to codegen a function call, the code fails to move one of theimm64
value to the stack region used to pass arguments.Turns out we had asserts which became unnecessary as part of an earlier fix submitted in #2723 – we no longer clobber any registers when we move
imm64
to a stack, but we still attempted to reserve a temporary register for clobbering. Turns out there are situations where reserving an R9 can fail, and this just happened to be one of them. We don't reserve R9 anywhere else in the codebase, luckily, making scope of this kind of bug fairly limited.As a future improvement I think it would make sense to see if we can
pick_gpr
orpick_temp_gpr
here and avoid thexchg
altogether if there are registers available for use, but I wanted to reduce the scope of this particular PR as much as possible in hopes of landing it more smoothly.Review