Skip to content
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

Local value numbering for MIR #91688

Open
pcwalton opened this issue Dec 9, 2021 · 2 comments
Open

Local value numbering for MIR #91688

pcwalton opened this issue Dec 9, 2021 · 2 comments
Labels
A-mir-opt Area: MIR optimizations T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@pcwalton
Copy link
Contributor

pcwalton commented Dec 9, 2021

Local value numbering, local to a basic block, doesn't require SSA form, unlike global value numbering. We could straightforwardly run this optimization on MIR. In many cases, this would subsume constant and copy propagation, and it would also let us do nice things like detect commutativity and fold a + b and b + a together. It may be possible to do things that LLVM won't, due to it being much easier to prove & and &muts disjoint when done on MIR.

@pcwalton pcwalton added the A-mir-opt Area: MIR optimizations label Dec 9, 2021
@pcwalton
Copy link
Contributor Author

pcwalton commented Dec 9, 2021

Oh, by the way, one nice thing about this is that it could be upgraded to global value numbering later if MIR grows an SSA form.

@camelid camelid added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Dec 10, 2021
@pcwalton
Copy link
Contributor Author

WIP branch is at https://github.com/pcwalton/rust/tree/value-numbering — it can CSE simple test cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mir-opt Area: MIR optimizations T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants