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

MIR optimization tracking issue. #44285

Closed
4 of 15 tasks
eddyb opened this issue Sep 3, 2017 · 9 comments
Closed
4 of 15 tasks

MIR optimization tracking issue. #44285

eddyb opened this issue Sep 3, 2017 · 9 comments
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html A-mir-opt Area: MIR optimizations C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC metabug Issues about issues themselves ("bugs about bugs") T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@eddyb
Copy link
Member

eddyb commented Sep 3, 2017

As all efforts have more stalled, I'll use this to note down some ideas (cc @rust-lang/compiler):

@eddyb eddyb added A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 3, 2017
@arielb1
Copy link
Contributor

arielb1 commented Sep 3, 2017

should SwitchInt and Assert (the two conditional terminators) always take an Lvalue and the constant case be replaced with a Goto by folding? Or is this too extreme?

Is that a normalization concern?

The MIR that enters borrowck etc. needs to have if-statements still present, otherwise we won't borrowck anything within an if false.

Second, if we're chasing normalization, the CFG changes made by SimplifyCfg are probably more important. I think one possibility is that we would store a worklist of MIR un-normalizations and have a "NormalizeMir" pass that runs over then and applies them. This is needed because sometimes we want a temporarily-unnormalized MIR, e.g. for keeping cfg-dependent info (dominatortree etc.) valid.

@arielb1
Copy link
Contributor

arielb1 commented Sep 3, 2017

limit lvalues with projections to the LHS of an assignment, Rvalue::Ref and Rvalue::Use, as opposed to all Operand::Consume - index projections in particular make Lvalue a tree right now which complicates a lot of transformations

I'm not sure why complicated operands in function calls are worse than complicated operands in Rvalue::Use. OTOH, forcing array indexes to be an Lvalue::Local should get rid of the "tree-like"ness

@eddyb
Copy link
Member Author

eddyb commented Sep 3, 2017

The MIR that enters borrowck etc. needs to have if-statements still present, otherwise we won't borrowck anything within an if false.

I'd expect that to be if temp with temp = false; just before it, FWIW.

OTOH, forcing array indexes to be an Lvalue::Local should get rid of the "tree-like"ness

Yeah, I'm leaning in that direction myself, we'll see how clean I can make it.

@arielb1
Copy link
Contributor

arielb1 commented Sep 3, 2017

I'd expect that to be if temp with temp = false; just before it, FWIW.

Nope. false is a valid operand, so we get a MIR if false. It's possible for the MIR builder to handle this, through.

I think that keeping an unnormalized SwitchInt is important for the same reason keeping an unnormalized CFG is important - we don't want to change things under our feet in the middle of a pass.

@eddyb
Copy link
Member Author

eddyb commented Sep 3, 2017

@arielb1 I mean that if if took an Lvalue so the only options were if temp and goto.

bors added a commit that referenced this issue Sep 5, 2017
[MIR] Restrict ProjectionElem::Index and Storage{Live,Dead} to Local.

(see #44285)

r? @nikomatsakis
@nox
Copy link
Contributor

nox commented Apr 3, 2018

Seems like there is more interest this year about MIR optimisations in general, so pinging WG here.

Cc @rust-lang/wg-codegen

@steveklabnik
Copy link
Member

Triage: still a lot of interest, no movement yet that I'm aware of.

@oli-obk oli-obk added the metabug Issues about issues themselves ("bugs about bugs") label Mar 5, 2019
@oli-obk
Copy link
Contributor

oli-obk commented Mar 5, 2019

we now have the @rust-lang/wg-mir-opt working group. @spastorino is currently remodelling mir::Place as described in https://paper.dropbox.com/doc/Place-2.0-current-PR-status--AYpEHnZVlMVhug5z7XDxiqgbAg-vmbnFv8VkCEuL57QfWWMH

@jonas-schievink jonas-schievink added A-mir-opt Area: MIR optimizations C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC and removed C-enhancement Category: An issue proposing an enhancement or a PR with one. labels Oct 7, 2020
@wesleywiser
Copy link
Member

Discussed in the "backlog bonanza" in this week's compiler team triage meeting. While the info contained in this issue is useful, most of the MIR opt work in the last two years has been happening elsewhere and it's not clear what this is actually tracking. We are therefore closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html A-mir-opt Area: MIR optimizations C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC metabug Issues about issues themselves ("bugs about bugs") T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

7 participants