summary refs log tree commit diff
path: root/src/librustc_mir/transform/simplify.rs
AgeCommit message (Collapse)AuthorLines
2019-12-11Rollup merge of #67134 - oli-obk:const_prop_zst, r=wesleywiserYuki Okushi-4/+9
Ensure that we get a hard error on generic ZST constants if their bod… …y causes an error during evaluation cc #67083 (does not fix because we still need the beta backport) r? @wesleywiser cc @RalfJung
2019-12-08Ensure that we get a hard error on generic ZST constants if their body ↵Oliver Scherer-4/+9
causes an error during evaluation
2019-12-05rustc: Apply clearer naming to BodyAndCache, fix Deref impl, remove unneeded ↵Paul Daniel Faria-5/+5
Index impl, remove body fn rustc_codegen_ssa: Fix BodyAndCache reborrow to Body and change instances of body() call to derefence rustc_mir: Fix BodyAndCache reborrow to Body and change intances of body() call to derefence
2019-12-02Remove HasLocalDecls impl from BodyCache's, properly reborrow to Body, ↵Paul Daniel Faria-23/+23
rename all body_cache back to body
2019-12-02Remove BodyCache.body and rely on Deref as much as possible for ↵Paul Daniel Faria-2/+2
ReadOnlyBodyCache
2019-12-02Fix tidy errorsPaul Daniel Faria-2/+6
2019-12-02Fix remaining compilation issuesPaul Daniel Faria-1/+2
2019-12-02Simplify BodyCache impl and fix all remaining type errors in librustc_mir ↵Paul Daniel Faria-23/+23
(lifetime errors still exist)
2019-12-02Address nits and remove unneeded passPaul Daniel Faria-5/+3
2019-12-02Move predecessors cache invalidation back to basic_blocks_mut, add a couple ↵Paul Daniel Faria-37/+36
more ensure_predecessors to prevent panics
2019-12-02Address linting errors caught by CIPaul Daniel Faria-2/+2
2019-12-02Stop invalidating predecessors cache when accessing unique basic block, ↵Paul Daniel Faria-33/+37
invalidate cache when accessing unique terminator
2019-11-27rustc: move debug info from LocalDecl and UpvarDecl into a dedicated ↵Eduard-Mihai Burtescu-8/+0
VarDebugInfo.
2019-11-08[mir-opt] Handle aggregates in SimplifyLocals passWesley Wiser-8/+15
2019-10-22Intern place projectionSantiago Pastorino-3/+8
2019-10-20Improve SimplifyLocals pass so it can remove unused constsWesley Wiser-22/+54
The `ConstProp` can cause many locals to be initialized to a constant value and then never read from. `ConstProp` can also evaluate ZSTs into constant values. Previously, many of these would be removed by other parts of the MIR optimization pipeline. However, evaluating ZSTs (especially `()`) into constant values defeated those parts of the optimizer and so in a2e3ed5c054b544df6ceeb9e612d39af819f4aae, I added a hack to `ConstProp` that skips evaluating ZSTs to avoid that regression. This commit changes `SimplifyLocals` so that it doesn't consider writes of const values to a local to be a use of that local. In doing so, `SimplifyLocals` is able to remove otherwise unused locals left behind by other optimization passes (`ConstProp` in particular).
2019-10-18Use Cow to handle modifications of projection in preparation for interningSantiago Pastorino-5/+6
2019-10-17Add process_* place hooks to improve code reutilizationSantiago Pastorino-16/+8
2019-10-17Prepare simplify MutVisitor to have projections internedSantiago Pastorino-0/+20
2019-09-29remove indexed_vec re-export from rustc_data_structurescsmoe-1/+1
2019-09-29remove bit_set re-export from rustc_data_structurescsmoe-1/+1
2019-08-22Move 'tcx lifetime on MirPassWesley Wiser-4/+4
2019-07-03Remove needless lifetimesJeremy Stucki-1/+1
2019-06-18rustc: remove 'x: 'y bounds (except from comments/strings).Eduard-Mihai Burtescu-2/+2
2019-06-14Run `rustfmt --file-lines ...` for changes from previous commits.Eduard-Mihai Burtescu-6/+1
2019-06-14Unify all uses of 'gcx and 'tcx.Eduard-Mihai Burtescu-2/+2
2019-06-12Run `rustfmt --file-lines ...` for changes from previous commits.Eduard-Mihai Burtescu-8/+7
2019-06-12rustc: replace `TyCtxt<'tcx, 'gcx, 'tcx>` with `TyCtxt<'gcx, 'tcx>`.Eduard-Mihai Burtescu-2/+2
2019-06-12Fix fallout from `deny(unused_lifetimes)`.Eduard-Mihai Burtescu-2/+2
2019-06-12rustc: replace `TyCtxt<'a, 'gcx, 'tcx>` with `TyCtxt<'tcx, 'gcx, 'tcx>`.Eduard-Mihai Burtescu-2/+2
2019-06-11rustc_mir: deny(unused_lifetimes).Eduard-Mihai Burtescu-1/+1
2019-06-09Changed usages of `mir` in librustc::mir and librustc_mir to `body`Jad Ghalayini-23/+23
2019-05-28Changes the type `mir::Mir` into `mir::Body`Claude-Alban RANÉLY-VERGÉ-DÉPRÉ-7/+7
The commit should have changed comments as well. At the time of writting, it passes the tidy and check tool. Revisions asked by eddyb : - Renamed of all the occurences of {visit/super}_mir - Renamed test structures `CachedMir` to `Cached` Fixing the missing import on `AggregateKind`
2019-04-26Remove region from borrow place contextsMatthew Jasper-2/+2
2019-02-09fix rebase falloutRalf Jung-2/+2
2019-02-08librustc_mir => 2018Taiki Endo-3/+3
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-13Make SimplifyCfg collapse goto chains from bb0Shotaro Yamada-1/+26
2018-11-07Rollup merge of #55734 - teresy:shorthand-fields, r=davidtwcokennytm-1/+1
refactor: use shorthand fields refactor: use shorthand for single fields everywhere (excluding tests).
2018-11-06refactor: use shorthand fieldsteresy-1/+1
2018-10-27Refactor and add `PlaceContext::AscribeUserTy`.David Wood-2/+4
This commit refactors `PlaceContext` to split it into four different smaller enums based on if the context represents a mutating use, non-mutating use, maybe-mutating use or a non-use (this is based on the recommendation from @oli-obk on Zulip[1]). This commit then introduces a `PlaceContext::AscribeUserTy` variant. `StatementKind::AscribeUserTy` is now correctly mapped to `PlaceContext::AscribeUserTy` instead of `PlaceContext::Validate`. `PlaceContext::AscribeUserTy` can also now be correctly categorized as a non-use which fixes an issue with constant promotion in statics after a cast introduces a `AscribeUserTy` statement. [1]: https://rust-lang.zulipchat.com/#narrow/stream/122657-wg-nll/subject/.2355288.20cast.20fails.20to.20promote.20to.20'static/near/136536949
2018-09-18Merge indexed_set.rs into bitvec.rs, and rename it bit_set.rs.Nicholas Nethercote-5/+5
Currently we have two files implementing bitsets (and 2D bit matrices). This commit combines them into one, taking the best features from each. This involves renaming a lot of things. The high level changes are as follows. - bitvec.rs --> bit_set.rs - indexed_set.rs --> (removed) - BitArray + IdxSet --> BitSet (merged, see below) - BitVector --> GrowableBitSet - {,Sparse,Hybrid}IdxSet --> {,Sparse,Hybrid}BitSet - BitMatrix --> BitMatrix - SparseBitMatrix --> SparseBitMatrix The changes within the bitset types themselves are as follows. ``` OLD OLD NEW BitArray<C> IdxSet<T> BitSet<T> -------- ------ ------ grow - grow new - (remove) new_empty new_empty new_empty new_filled new_filled new_filled - to_hybrid to_hybrid clear clear clear set_up_to set_up_to set_up_to clear_above - clear_above count - count contains(T) contains(&T) contains(T) contains_all - superset is_empty - is_empty insert(T) add(&T) insert(T) insert_all - insert_all() remove(T) remove(&T) remove(T) words words words words_mut words_mut words_mut - overwrite overwrite merge union union - subtract subtract - intersect intersect iter iter iter ``` In general, when choosing names I went with: - names that are more obvious (e.g. `BitSet` over `IdxSet`). - names that are more like the Rust libraries (e.g. `T` over `C`, `insert` over `add`); - names that are more set-like (e.g. `union` over `merge`, `superset` over `contains_all`, `domain_size` over `num_bits`). Also, using `T` for index arguments seems more sensible than `&T` -- even though the latter is standard in Rust collection types -- because indices are always copyable. It also results in fewer `&` and `*` sigils in practice.
2018-08-04Normalize DebugInfoLevel to standard styleMark Rousskov-2/+2
2018-08-01Split out growth functionality into BitVector typeMark Rousskov-5/+5
2018-07-25parameterize `BitVector` and `BitMatrix` by their index typesNiko Matsakis-14/+17
2018-05-17Rename trans to codegen everywhere.Irina Popa-1/+1
2018-05-01rustc: return impl Iterator from Terminator(Kind)::successors(_mut).Eduard-Mihai Burtescu-5/+5
2018-02-20rustc_mir: do not remove dead user variables if debuginfo needs them.Eduard-Mihai Burtescu-4/+13
2017-12-03funnel all unwind paths through a single Resume blockAriel Ben-Yehuda-34/+0
This simplifies analysis and borrow-checking because liveness at the resume point can always be simply propagated. Later on, the "dead" Resumes are removed.
2017-12-01MIR: s/Lvalue/Place in type names.Eduard-Mihai Burtescu-4/+4