Skip to content

[SOL] Do not add a return after a JA #155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 24, 2025

Conversation

LucasSte
Copy link
Collaborator

@LucasSte LucasSte commented Jun 16, 2025

We can simplify the patch of function with the return instruction, if we know that last MachineBasicBlock is also the last block in the ELF layout.

Since PreEmitPeephole happens after block placement, that assumption holds.

Also, I avoided adding return when the last instruction is a ja.

@LucasSte LucasSte force-pushed the no-ja branch 2 times, most recently from 20b3c27 to cef91ba Compare June 20, 2025 23:14
@LucasSte LucasSte requested a review from Lichtso June 23, 2025 15:28
@LucasSte LucasSte marked this pull request as ready for review June 23, 2025 15:28
@Lichtso
Copy link
Collaborator

Lichtso commented Jun 23, 2025

Isn't this very niche? It can only ever optimize a single instruction, right?

@LucasSte
Copy link
Collaborator Author

Isn't this very niche? It can only ever optimize a single instruction, right?

This PR simplifies a couple of things:

  1. I was adding a return to every terminator block that didn't end in return. We do not need to do that for every block, but only the last one in the ELF layout. Hence, I removed the iteration.
  2. The return is not necessary if the last instruction is a ja.

@LucasSte LucasSte merged commit c0e0c7f into anza-xyz:solana-rustc/19.1-2024-12-03 Jun 24, 2025
21 checks passed
@LucasSte LucasSte deleted the no-ja branch June 24, 2025 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants