about summary refs log tree commit diff
path: root/compiler/rustc_mir_dataflow/src/impls
AgeCommit message (Collapse)AuthorLines
2023-12-08Tweak `GenKillAnalysis`.Nicholas Nethercote-10/+10
`GenKillAnalysis` has five methods that take a transfer function arg: - `statement_effect` - `before_statement_effect` - `terminator_effect` - `before_terminator_effect` - `call_return_effect` All the transfer function args have type `&mut impl GenKill<Self::Idx>`, except for `terminator_effect`, which takes the simpler `Self::Domain`. But only the first two need to be `impl GenKill`. The other three can all be `Self::Domain`, just like `Analysis`. So this commit changes the last two to take `Self::Domain`, making `GenKillAnalysis` and `Analysis` more similar. (Another idea would be to make all these methods `impl GenKill`. But that doesn't work: `MaybeInitializedPlaces::terminator_effect` requires the arg be `Self::Domain` so that `self_is_unwind_dead(place, state)` can be called on it.)
2023-11-27Remove uses of `ResultsClonedCursor`.Nicholas Nethercote-13/+12
By just cloning the entire `Results` in the one place where `ResultsClonedCursor` was used. This is extra allocations but the performance effect is negligible.
2023-11-27Remove some unused code relating to `ResultsCloned`.Nicholas Nethercote-12/+0
2023-11-24Remove unused arguments from `on_all_children_bits`.Nicholas Nethercote-24/+13
`on_all_children_bits` has two arguments that are unused: `tcx` and `body`. This was not detected by the compiler because it's a recursive function. This commit removes them, and removes lots of other arguments and fields that are no longer necessary.
2023-11-24Remove unused `EverInitializedPlaces::tcx` field.Nicholas Nethercote-4/+2
2023-11-24Remove unneeded derives from `MaybeLiveLocals`.Nicholas Nethercote-1/+0
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-2/+2
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-11-08rename `BorrowKind::Shallow` to `Fake`lcnr-2/+2
also adds some comments
2023-11-08generator layout: ignore fake borrowslcnr-2/+7
2023-10-21Remove on_all_drop_children_bits.Camille GILLOT-2/+2
As drop elaboration only tracks places that need dropping, is has become equivalent to `on_all_children_bits`.
2023-10-21Avoid using a magic value for untracked locals.Camille GILLOT-3/+7
2023-10-20s/generator/coroutine/Oli Scherer-4/+4
2023-10-20s/Generator/Coroutine/Oli Scherer-4/+4
2023-08-24when terminating during unwinding, show the reason whyRalf Jung-3/+3
2023-08-20give some unwind-related terminators a more clear nameRalf Jung-6/+6
2023-08-16Use Terminator::edges for backward analysis too.Camille GILLOT-1/+1
2023-08-16Only evaluate yield place after resume in liveness.Camille GILLOT-15/+31
2023-08-16Rename YieldResumeEffect.Camille GILLOT-6/+6
2023-08-16Make TerminatorEdge plural.Camille GILLOT-15/+15
2023-08-16Rename MaybeUnreachable.Camille GILLOT-7/+6
2023-08-16Only run MaybeInitializedPlaces once for drop elaboration.Camille GILLOT-9/+63
2023-08-16Allow apply_terminator_effect to customize edges.Camille GILLOT-99/+78
2023-08-16Move domain_size to GenKillAnalysis.Camille GILLOT-0/+36
2023-08-16Move initialization dataflow impls into their own module.Camille GILLOT-749/+756
2023-08-16Simplify for_each_mut_borrow.Camille GILLOT-58/+9
2023-07-19Turn copy into moves during DSE.Camille GILLOT-1/+2
2023-07-12Re-format let-else per rustfmt updateMark Rousskov-2/+6
2023-07-04bring back un_derefer and rewrite it againDrMeepster-4/+4
2023-06-08Auto merge of #108293 - Jarcho:mut_analyses, r=eholkbors-66/+74
Take MIR dataflow analyses by mutable reference The main motivation here is any analysis requiring dynamically sized scratch memory to work. One concrete example would be pointer target tracking, where tracking the results of a dereference can result in multiple possible targets. This leads to processing multi-level dereferences requiring the ability to handle a changing number of potential targets per step. A (simplified) function for this would be `fn apply_deref(potential_targets: &mut Vec<Target>)` which would use the scratch space contained in the analysis to send arguments and receive the results. The alternative to this would be to wrap everything in a `RefCell`, which is what `MaybeRequiresStorage` currently does. This comes with a small perf cost and loses the compiler's guarantee that we don't try to take multiple borrows at the same time. For the implementation: * `AnalysisResults` is an unfortunate requirement to avoid an unconstrained type parameter error. * `CloneAnalysis` could just be `Clone` instead, but that would result in more work than is required to have multiple cursors over the same result set. * `ResultsVisitor` now takes the results type on in each function as there's no other way to have access to the analysis without cloning it. This could use an associated type rather than a type parameter, but the current approach makes it easier to not care about the type when it's not necessary. * `MaybeRequiresStorage` now no longer uses a `RefCell`, but the graphviz formatter now does. It could be removed, but that would require even more changes and doesn't really seem necessary.
2023-05-29unique borrows are mutating useslcnr-2/+1
2023-05-18Take MIR dataflow analyses by mutable reference.Jason Newcomb-66/+74
2023-05-09Explicitly skip arguments.Camille GILLOT-0/+1
2023-05-09Implement SSA-based reference propagation.Camille GILLOT-1/+67
2023-04-29Make PlaceMention a non-mutating use.Camille GILLOT-0/+1
2023-04-24Split `{Idx, IndexVec, IndexSlice}` into their own modulesMaybe Waffle-1/+1
2023-04-06Rename `Abort` terminator to `Terminate`Gary Guo-3/+3
Unify terminology used in unwind action and terminator, and reflect the fact that a nounwind panic is triggered instead of an immediate abort is triggered for this terminator.
2023-03-09Introduce a no-op PlaceMention statement for `let _ =`.Camille GILLOT-0/+2
2023-03-07Remove DropAndReplace terminatorGiacomo Pasini-4/+1
PR 107844 made DropAndReplace unused, let's remove it completely from the codebase.
2023-02-16Replace some `then`s with some `then_some`sMaybe Waffle-1/+1
2023-02-16`if $c:expr { Some($r:expr) } else { None }` =>> `$c.then(|| $r)`Maybe Waffle-7/+1
2023-02-06Only exclude locals if the place is not indirect.Camille GILLOT-1/+3
2023-01-23Create stable metric to measure long computation in Const EvalBryan Garza-0/+2
This patch adds a `MirPass` that tracks the number of back-edges and function calls in the CFG, adds a new MIR instruction to increment a counter every time they are encountered during Const Eval, and emit a warning if a configured limit is breached.
2023-01-17Remove double spaces after dots in commentsMaybe Waffle-1/+1
2022-12-20rustc: Remove needless lifetimesJeremy Stucki-2/+2
2022-12-13Don't require owned data in `MaybeStorageLive`Jakob Degen-6/+7
2022-11-26Rewrite dest prop.Jakob Degen-124/+0
This fixes a number of correctness issues from the previous version. Additionally, we use a new strategy which has much better performance charactersitics and also finds more opportunities to apply the optimization.
2022-09-06Generalize the Assume intrinsic statement to a general Intrinsic statementOli Scherer-4/+2
2022-09-06Lower the assume intrinsic to a MIR statementOli Scherer-0/+2
2022-08-25Add method that applies DefUse effectTomasz Miąsko-15/+11
2022-08-25Fix liveness analysis for yield terminatorsTomasz Miąsko-32/+61
A resume place is evaluated and assigned to only after a yield terminator resumes. Ensure that locals used when evaluating the resume place are live across the yield.