rust-lang / rust-lang/rustc_codegen_cranelift

Improve stack optimization pass

Open
#846 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-enhancement optimize-speed
Dominant language
Rust
Stars
2.1k
Forks
157
Avg merge
1d 19h
Merged PRs (30d)
3

Description

  • Fold stack_addr into load/store.
  • Remove stack_{addr,load} with unused return value.
  • Perform store to load forwarding when stack_addr is not used on a stack slot.
    • Single ebb store to load forwarding
    • Cross ebb store to load forwarding
    • Store to load forwarding with are multiple stores, but is always after others and before the load
    • Store to load forwarding with phi's
  • Remove redundant stack_store. (no stack_load between current and next stack_store and no stack_addr before current stack_store)
  • Fold stack_load into bitcast when stack_load is only used by that bitcast.

WIP implementation at https://github.com/bjorn3/rustc_codegen_cranelift/tree/opt_stack2reg
Edit: merged

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named. First verify the current stack optimization pass and whether the unchecked checklist items remain unresolved, since the issue notes that the WIP implementation was merged. Done would mean the remaining stack optimization cases are implemented and covered by the project's existing compiler tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
18/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.