Closed
Description
As all efforts have more stalled, I'll use this to note down some ideas (cc @rust-lang/compiler):
-
rustc_mir::expand
: take a MIR fragment (e.g. an intrinsic call) and lazily emit another MIR fragment which is the equivalent expansion -
rustc_mir::reduce
: generalized dataflow toolkit for writing localized transformations which must cause dataflow information to converge, and thus can be run until fixpoint- this will require require a lot of design work if we want to pull it off, at least for anything more than constant folding and CFG simplification
- similar to
expand
but instead of (just) emitting a MIR fragment, a few blessed mutations (somewhat like @arielb1's patch tools) could be allowed, which are interpreted by the dataflow toolkit with minimal recomputation
- extract and cache the points of the CFG through which dataflow might change during iterations (e.g. loop bodies and the backedges pointing to them) to minimize the copies of the dataflow state that must be kept around - that is, a function with no loops should complete forward dataflow with no per-block state caching (assuming RPO traversal)
- would allow keeping more than plain bits without worrying as much about memory usage
- could let us switch to EBBs without caching the non-EBB CFG, which is what @Mark-Simulacrum hit when he attempted EBBs
- [[MIR] Restrict ProjectionElem::Index and Storage{Live,Dead} to Local. #44308]
useLocal
instead ofOperand
for index projections, so thatLvalue
stops being a tree - [[MIR] Restrict ProjectionElem::Index and Storage{Live,Dead} to Local. #44308]
useLocal
instead ofLvalue
inStorage{Live,Dead}
- compress some lvalues (field/const-index paths) into
[u8; 8]
/u64
forO(1)
dataflow lookup or even on-the-fly SROA - [MIR: split Operand::Consume into Copy and Move. #46142]
splitOperand::Consume
into copies and moves, the latter invalidating all borrows - last-use analysis to turn the last copy of an unborrowed local into a move
- MIR borrowck could do more here, at least in safe code
- shrink/regenerate live ranges based on moves
- propagate destinations backwards (and sources forward?) through moves
- remove
Rvalue::Aggregate
in favor of field assignment andSetDiscriminant
SetDiscriminant(0)
on non-enums can be pruned after borrowck runs
- track fields and overlaps within a local, in def-use chains
- [[Place 2.0] Convert Place's projection to a boxed slice #63420]
mir::Place
should not be a recursive datastructure (https://paper.dropbox.com/doc/Place-2.0-current-PR-status--AYpEHnZVlMVhug5z7XDxiqgbAg-vmbnFv8VkCEuL57QfWWMH) - Make
Deref
not a place projection (https://paper.dropbox.com/doc/Place-2.0--AYrQzvo5k2eL2v57XD__sDrZAg-9NjhX4N9I3dEt6YCJM8Ln) - Make
Index
not a place projection (https://paper.dropbox.com/doc/Place-2.0--AYrQzvo5k2eL2v57XD__sDrZAg-9NjhX4N9I3dEt6YCJM8Ln)
Metadata
Metadata
Assignees
Labels
Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlArea: MIR optimizationsCategory: An issue tracking the progress of sth. like the implementation of an RFCRelevant to the compiler team, which will review and decide on the PR/issue.Issues about issues themselves ("bugs about bugs")