Dylan MacKenzie
8287842eb4
Use Body
everywhere
2020-04-22 09:57:43 -07:00
Wesley Wiser
9666d31bcf
Respond to code review feedback
...
- Remove reads of indirect `Place`s
- Add comments explaining what the algorithm does
2020-04-16 08:34:37 -04:00
Wesley Wiser
da8f3bbf32
Directly modify the used_locals
vec
...
Fixes perf regression in `optimized_mir` query
2020-04-15 14:58:54 -04:00
Wesley Wiser
de3cf6e8a4
Run SimplifyLocals
iteratively until we get to a fixedpoint
2020-04-15 14:58:53 -04:00
Wesley Wiser
7c0802b341
Remove other Rvalues
2020-04-15 14:53:41 -04:00
Jonas Schievink
72ae73ae61
Pass the PlaceElem::Index
local to visit_local
2020-04-11 01:39:50 +02:00
Wesley Wiser
75e2e8c71b
Remove unused discriminant reads from MIR bodies
...
Allow the `SimplifyLocals` pass to remove reads of discriminants if the
read is never used.
2020-04-02 08:14:34 -04:00
Mazdak Farrokhzad
1ccb0b4a02
rustc -> rustc_middle part 3 (rustfmt)
2020-03-30 07:19:55 +02:00
Mazdak Farrokhzad
0cb9e36090
rustc -> rustc_middle part 2
2020-03-30 07:16:56 +02:00
Dylan MacKenzie
538cdef64b
Use &
to do deref coercion for ReadOnlyBodyAndCache
2020-03-29 13:30:26 -07:00
Dylan MacKenzie
b641e9e358
Make Visitor::visit_body
take a simple Body
2020-03-29 11:56:36 -07:00
bors
23de8275c9
Auto merge of #68551 - Marwes:allocations_mir, r=ecstatic-morse
...
perf: Reuse a Vec in mir simplification
Just moves the vec out of the outer loop so it is reused every iteration
2020-03-12 09:16:53 +00:00
Matthias Krüger
d3e5177f81
Use .next() instead of .nth(0) on iterators.
2020-03-03 03:15:03 +01:00
Markus Westerlind
851e9d64ba
s/merged_block_count/statements_to_merge/g
2020-03-02 20:08:21 +01:00
Markus Westerlind
84c024d92f
Clarify mir block merging
2020-02-16 23:23:44 +01:00
Markus Westerlind
2440998666
perf(mir): Reserve enough space for the merged blocks before appending
2020-02-13 11:44:12 +01:00
Markus Westerlind
33513fad80
Avoid an intermediate Vec in mir simplify
2020-02-13 11:13:13 +01:00
Markus Westerlind
dec8166abc
Use Vec::append
2020-02-13 11:13:13 +01:00
Markus Westerlind
851a701f90
Reuse a Vec in mir simplification
2020-02-13 11:13:13 +01:00
Santiago Pastorino
5d9b399044
Remove PlaceBase enum and make Place base field be local: Local
2020-01-10 09:08:25 +01:00
Santiago Pastorino
fd5aa32c35
Remove Static from PlaceBase
2020-01-10 09:08:24 +01:00
Mark Rousskov
a06baa56b9
Format the world
2019-12-22 17:42:47 -05:00
Yuki Okushi
a7f930748c
Rollup merge of #67134 - oli-obk:const_prop_zst, r=wesleywiser
...
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-11 04:32:57 +09:00
Oliver Scherer
df26968bb5
Ensure that we get a hard error on generic ZST constants if their body causes an error during evaluation
2019-12-08 01:55:14 +01:00
Paul Daniel Faria
756aa1e46c
rustc: Apply clearer naming to BodyAndCache, fix Deref impl, remove unneeded 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-05 22:58:41 -05:00
Paul Daniel Faria
b2fe254c98
Remove HasLocalDecls impl from BodyCache's, properly reborrow to Body, rename all body_cache back to body
2019-12-02 08:40:56 -05:00
Paul Daniel Faria
595d161d36
Remove BodyCache.body and rely on Deref as much as possible for ReadOnlyBodyCache
2019-12-02 08:38:16 -05:00
Paul Daniel Faria
67b7a78231
Fix tidy errors
2019-12-02 08:38:16 -05:00
Paul Daniel Faria
4de31b26d1
Fix remaining compilation issues
2019-12-02 08:37:04 -05:00
Paul Daniel Faria
fc6b58d0a8
Simplify BodyCache impl and fix all remaining type errors in librustc_mir (lifetime errors still exist)
2019-12-02 08:35:08 -05:00
Paul Daniel Faria
52cc85f008
Address nits and remove unneeded pass
2019-12-02 08:30:30 -05:00
Paul Daniel Faria
ad734680af
Move predecessors cache invalidation back to basic_blocks_mut, add a couple more ensure_predecessors to prevent panics
2019-12-02 08:30:30 -05:00
Paul Daniel Faria
570e4182e8
Address linting errors caught by CI
2019-12-02 08:30:30 -05:00
Paul Daniel Faria
f534d9f8c4
Stop invalidating predecessors cache when accessing unique basic block, invalidate cache when accessing unique terminator
2019-12-02 08:30:30 -05:00
Eduard-Mihai Burtescu
563ed27c01
rustc: move debug info from LocalDecl and UpvarDecl into a dedicated VarDebugInfo.
2019-11-27 19:22:03 +02:00
Wesley Wiser
4505ff4bad
[mir-opt] Handle aggregates in SimplifyLocals pass
2019-11-08 22:28:53 -05:00
Santiago Pastorino
d32c2865d6
Intern place projection
2019-10-22 10:33:36 -03:00
Wesley Wiser
2ec73395b9
Improve SimplifyLocals pass so it can remove unused consts
...
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 a2e3ed5c05
, 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-20 23:49:42 -04:00
Santiago Pastorino
48349960e6
Use Cow to handle modifications of projection in preparation for interning
2019-10-18 10:06:13 -04:00
Santiago Pastorino
d53fc9cae5
Add process_* place hooks to improve code reutilization
2019-10-17 22:06:56 -04:00
Santiago Pastorino
591cc9aede
Prepare simplify MutVisitor to have projections interned
2019-10-17 22:06:55 -04:00
csmoe
64f61c7888
remove indexed_vec re-export from rustc_data_structures
2019-09-29 16:48:31 +00:00
csmoe
d20183dbbf
remove bit_set re-export from rustc_data_structures
2019-09-29 16:11:30 +00:00
Wesley Wiser
666180c324
Move 'tcx lifetime on MirPass
2019-08-22 06:36:30 -04:00
Jeremy Stucki
0477e07272
Remove needless lifetimes
2019-07-03 10:00:26 +02:00
Eduard-Mihai Burtescu
b25b466a88
rustc: remove 'x: 'y bounds (except from comments/strings).
2019-06-18 18:10:21 +03:00
Eduard-Mihai Burtescu
afc39bbf24
Run rustfmt --file-lines ...
for changes from previous commits.
2019-06-14 18:58:32 +03:00
Eduard-Mihai Burtescu
f3f9d6dfd9
Unify all uses of 'gcx and 'tcx.
2019-06-14 18:58:23 +03:00
Eduard-Mihai Burtescu
fff08cb043
Run rustfmt --file-lines ...
for changes from previous commits.
2019-06-12 13:38:28 +03:00
Eduard-Mihai Burtescu
17cdd356da
rustc: replace TyCtxt<'tcx, 'gcx, 'tcx>
with TyCtxt<'gcx, 'tcx>
.
2019-06-12 13:38:27 +03:00