[SOL] Implement hints of stack stores and loads #163
Merged
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.
Summary
LLVM has its internal passes InlineSpiller and StackSlotColoring, which determine the stack layout and possible spills. These passes use
isStoreToStackSlot
andisLoadFromStackSlot
as hints, but they were not implemented.Solution
Implement the two functions and their variants, and add a test.
Remarks
There is still a third variation of those functions
isStoreToStackSlotPostFE
andisLoadFromStackSlotPostFE
(post PE means post frame pointer elimination). They follow a different logic and I left them out for another moment.Benchmarks
This is a benchmark of the solana program entrypoint. There is one less CU for each account (the delta is based on the LLVM master branch):
This is Agave's printout of the
assert_instruction_count
function (again the diff is based on the LLVM master branch):