Erik Desjardins
47f8bacc46
remove unnecessary condition
...
`_local` isn't visited in `_local = <rhs>` statements in the situation
we care about
2021-03-14 20:21:20 -04:00
Simon Vandel Sillesen
bb36e3c7e7
Move ZST check inside UsedLocals
2021-03-13 18:00:28 -05:00
Simon Vandel Sillesen
4e901be57d
Extend SimplifyLocals to remove ZST writes
2021-03-13 17:58:11 -05:00
kadmin
37a6c04718
Update interpret step
2021-03-09 16:54:13 +00:00
bors
6b56603e35
Auto merge of #80475 - simonvandel:fix-77355, r=oli-obk
...
New mir-opt pass to simplify gotos with const values (reopening #77486 )
Reopening PR #77486
Fixes #77355
This pass optimizes the following sequence
```rust
bb2: {
_2 = const true;
goto -> bb3;
}
bb3: {
switchInt(_2) -> [false: bb4, otherwise: bb5];
}
```
into
```rust
bb2: {
_2 = const true;
goto -> bb5;
}
```
2021-02-24 07:23:54 +00:00
Dylan DPC
cc07061190
Rollup merge of #82091 - henryboisdequin:use-place-ref-more, r=RalfJung
...
use PlaceRef abstractions more consistently
Addresses this [comment](https://github.com/rust-lang/rust/pull/80865/files#r558978715 )
Associated issue: #80647
r? ```@RalfJung```
2021-02-23 02:51:50 +01:00
Simon Vandel Sillesen
a6dccfeb23
New mir-opt pass to simplify gotos with const values
...
Fixes #77355
2021-02-22 21:03:57 +01:00
Henry Boisdequin
a9c6188889
make super_projection
take a PlaceRef
2021-02-20 16:56:08 +05:30
Tomasz Miąsko
dc6ec3596b
Avoid memory allocation when removing dead blocks
...
Use `reachable_as_bitset` to reuse a bitset from the traversal rather
than allocating it seprately. Additionally check if there are any
unreachable blocks before proceeding.
2021-01-28 00:00:00 +00:00
Tomasz Miąsko
c7bad7ba5d
Avoid logging the whole MIR body in SimplifyCfg
2021-01-17 15:57:21 +01:00
Tomasz Miąsko
4c3e06a0ba
simplify-locals: Remove unused assignments regardless of rvalue kind
2020-10-26 10:48:28 +01:00
Tomasz Miąsko
52d3782685
simplify-locals: Remove unused set-discriminant statements
...
Update affected ui & incremental tests to use a user declared variable
bindings instead of temporaries. The former are preserved because of
debuginfo, the latter are not.
2020-10-26 10:41:44 +01:00
Tomasz Miąsko
e1e48ae29b
simplify-locals: Change RemoveStatements visitor into a function
...
No functionl changes intended.
2020-10-26 10:33:45 +01:00
Tomasz Miąsko
a6b64be8b5
simplify-locals: Unify use count visitors
...
The simplify locals implementation uses two different visitors to update
the locals use counts. The DeclMarker calculates the initial use counts.
The StatementDeclMarker updates the use counts as statements are being
removed from the block.
Replace them with a single visitor that can operate in either mode,
ensuring consistency of behaviour.
Additionally use exhaustive match to clarify what is being optimized.
No functional changes intended.
2020-10-26 10:33:39 +01:00
Tomasz Miąsko
11269536e2
simplify-locals: Represent use counts with u32
2020-10-26 10:33:31 +01:00
Dylan MacKenzie
6f61e71648
Remember the MirSource
for each Body
2020-10-04 11:01:38 -07:00
Matthias Krüger
40dddd3305
use matches!() macro for simple if let conditions
2020-09-18 20:28:35 +02:00
mark
9e5f7d5631
mv compiler to compiler/
2020-08-30 18:45:07 +03:00