about summary refs log tree commit diff
path: root/src/librustc_mir/transform/generator.rs
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-1506/+0
2020-08-24hir: consistent use and naming of lang itemsDavid Wood-3/+3
This commit adjusts the naming of various lang items so that they are consistent and don't include prefixes containing the target or "LangItem". In addition, lang item variants are no longer exported from the `lang_items` module. Signed-off-by: David Wood <david@davidtw.co>
2020-08-20Auto merge of #75562 - oli-obk:const_prop_no_aggregates, r=wesleywiserbors-12/+25
Check that we don't use `Rvalue::Aggregate` after the deaggregator fixes #75481 r? @wesleywiser cc @RalfJung (modified the validator)
2020-08-18Moved coverage counter injection from BasicBlock to Statement.Rich Kadel-0/+1
2020-08-18Validate the MIR of all optimizations in the mir-opt directoryOliver Scherer-12/+25
2020-07-08Add `reachable` and friends to `mir::traversal` moduleDylan MacKenzie-3/+1
2020-06-24Emit line info for generator variantsTyler Mandry-1/+21
2020-06-19Incorporate review suggestionsDylan MacKenzie-5/+8
Co-authored-by: Tyler Mandry <tmandry@gmail.com>
2020-06-19Look for stores between non-conflicting generator saved localsDylan MacKenzie-13/+147
This is to prevent the miscompilation in #73137 from reappearing. Only runs with `-Zvalidate-mir`.
2020-06-19Use newtype to map from `Local` to `GeneratorSavedLocal`Dylan MacKenzie-44/+64
2020-06-18Rollup merge of #72814 - RalfJung:mir-visir-terminator, r=oli-obkManish Goregaokar-10/+7
remove visit_terminator_kind from MIR visitor For some reason, we had both `visit_terminator` and `visit_terminator_kind`. In contrast, for `Statement` we just have `visit_statement`. So this cleans things up by removing `visit_terminator_kind` and porting its users to `visit_terminator`.
2020-06-16rename location field of Drop terminators to placeRalf Jung-7/+4
2020-06-16remove visit_terminator_kind from MIR visitorRalf Jung-3/+3
2020-06-14Don't run generator transform when there's a TyErrJonas Schievink-1/+5
2020-06-08Revert #71956Dylan MacKenzie-127/+136
2020-06-07Rollup merge of #72908 - RalfJung:false-edge, r=matthewjasperDylan DPC-1/+1
rename FalseEdges -> FalseEdge There's just a single false edge in this terminator, not multiple of them. r? @matthewjasper @jonas-schievink
2020-06-07rename FalseEdges -> FalseEdgeRalf Jung-1/+1
2020-05-30Be more careful around ty::Error in generatorsJonas Schievink-26/+43
2020-05-28Auto merge of #72494 - lcnr:predicate-cleanup, r=nikomatsakisbors-2/+2
Pass more `Copy` types by value. There are a lot of locations where we pass `&T where T: Copy` by reference, which should both be slightly less performant and less readable IMO. This PR currently consists of three fairly self contained commits: - passes `ty::Predicate` by value and stops depending on `AsRef<ty::Predicate>`. - changes `<&List<_>>::into_iter` to iterate over the elements by value. This would break `List`s of non copy types. But as the only list constructor requires `T` to be copy anyways, I think the improved readability is worth this potential future restriction. - passes `mir::PlaceElem` by value. Mir currently has quite a few copy types which are passed by reference, e.g. `Local`. As I don't have a lot of experience working with MIR, I mostly did this to get some feedback from people who use MIR more frequently - tries to reuse `ty::Predicate` in case it did not change in some places, which should hopefully fix the regression caused by #72055 r? @nikomatsakis for the first commit, which continues the work of #72055 and makes adding `PredicateKind::ForAll` slightly more pleasant. Feel free to reassign though
2020-05-23fix discriminant type in generator transformRalf Jung-1/+1
2020-05-23iterate List by valueBastian Kauschke-2/+2
2020-05-19Document why we don't look at storage livenessDylan MacKenzie-0/+9
...when determining what locals are live. A local cannot be borrowed before it is `storage_live` and `MaybeBorrowedLocals` already invalidates borrows on `StorageDead`. Likewise, a local cannot be initialized before it is marked StorageLive and is marked as uninitialized after `StorageDead`.
2020-05-19Look for storage conflicts before terminator effectDylan MacKenzie-5/+6
2020-05-19Add comment for strange conditionalDylan MacKenzie-0/+1
2020-05-19Add comment explaining the extra `record_conflicts`Dylan MacKenzie-0/+4
2020-05-19Clean up generator live locals analysisDylan MacKenzie-137/+113
Instead of using a bespoke dataflow analysis, `MaybeRequiresStorage`, for computing locals that need to be stored across yield points and that have conflicting storage, use a combination of simple, generally applicable dataflow analyses. In this case, the formula for locals that are live at a yield point is: live_across_yield := (live & init) | (!movable & borrowed) and the formula for locals that require storage (and thus may conflict with others) at a given point is: requires_storage := init | borrowed `init` is `MaybeInitializedLocals`, a direct equivalent of `MaybeInitializedPlaces` that works only on whole `Local`s. `borrowed` and `live` are the pre-existing `MaybeBorrowedLocals` and `MaybeLiveLocals` analyses respectively.
2020-05-18Add asm! to MIRAmanieu d'Antras-1/+2
2020-05-13add spans to `require_lang_items`Bastian Kauschke-1/+1
2020-05-13use `require_lang_item` over `unwrap`.Bastian Kauschke-2/+3
2020-05-09Visit move out of `_0` when visiting `return`Jonas Schievink-0/+10
2020-05-09Rollup merge of #71942 - nnethercote:shrink-LocalDecl, r=matthewjasperDylan DPC-41/+15
Shrink `LocalDecl` `LocalDecl` contributes 4-8% of peak heap memory usage on a range of benchmarks. This PR reduces its size from 128 bytes to 56 bytes on 64-bit, and does some clean-ups as well. r? @matthewjasper
2020-05-06Improve `LocalDecl` creation.Nicholas Nethercote-28/+6
This commit adds some new `LocalDecl` methods: - `with_source_info`, a most general constructor. - `new`, a variant of `with_source_info` which represents the most common use case. - `internal` a modifying method (like the already present `immutable`). It removes some old `LocalDecl` methods: - `new_internal` and `new_local`, because they're subsumed by the new methods. - `new_return_place`, because it was identical to `new_temp`. Finally, it cleans up all the use sites.
2020-05-06Add `SourceInfo::outermost`.Nicholas Nethercote-14/+10
2020-05-04Import dataflow impls via the `impls` submoduleDylan MacKenzie-2/+2
2020-05-03Use new liveness analysis during generator transformDylan MacKenzie-22/+24
2020-05-03Support backward dataflow analysesDylan MacKenzie-9/+4
2020-05-03Rename `live_locals` -> `live_locals_at_any_suspension_point`Dylan MacKenzie-11/+12
2020-04-29Remove Session::no_landing_pads()Amanieu d'Antras-1/+2
2020-04-25Replace hash map with IndexVec for liveness data.Alex Aktsipetrov-21/+13
Utilize IndexVec::push to avoid redundant object creation.
2020-04-22Auto merge of #71044 - ecstatic-morse:body-predecessor-cache, r=oli-obkbors-29/+16
Remove `BodyAndCache` ...returning to the original approach using interior mutability within `Body`. This simplifies the API at the cost of some uncontended mutex locks when the parallel compiler is enabled. The current API requires you to either have a mutable reference to `Body` (`&mut BodyAndCache`), or to compute the predecessor graph ahead of time by creating a `ReadOnlyBodyAndCache`. This is not a good fit for, e.g., the dataflow framework, which 1. does not mutate the MIR 2. only sometimes needs the predecessor graph (for backward dataflow problems)
2020-04-22Use `Body` everywhereDylan MacKenzie-29/+16
2020-04-21visit_place_base is just visit_localSantiago Pastorino-2/+2
2020-04-12Rollup merge of #71013 - jonas-schievink:visit-projection, r=eddybDylan DPC-7/+0
Pass the `PlaceElem::Index` local to `visit_local` Fixes https://github.com/rust-lang/rust/issues/71008 cc @rust-lang/wg-mir-opt r? @spastorino
2020-04-11Rollup merge of #70957 - oli-obk:lazy_repeat_length_eval_ice, r=matthewjasperMazdak Farrokhzad-1/+4
Normalize MIR locals' types for generator layout computation. fixes #70905
2020-04-11Pass the `PlaceElem::Index` local to `visit_local`Jonas Schievink-7/+0
2020-04-09Explain why we remove `self` from storage live localsDylan MacKenzie-0/+1
2020-04-09Use new utility in `transform/generator.rs`Dylan MacKenzie-34/+40
2020-04-09Normalize MIR locals' types for generator layout computation.Oliver Scherer-1/+4
2020-04-02nix rustc_target::abi::* reexport in ty::layoutMazdak Farrokhzad-1/+1
2020-03-31Use Place directly, it's Copy more use casesSantiago Pastorino-1/+1