about summary refs log tree commit diff
path: root/compiler/rustc_mir/src/transform/simplify.rs
AgeCommit message (Collapse)AuthorLines
2021-09-07Move rustc_mir::transform to rustc_mir_transform.Camille GILLOT-592/+0
2021-08-18Remove box syntax from rustc_mirest31-2/+2
2021-06-01Reland - Report coverage `0` of dead blocksRich Kadel-5/+80
Fixes: #84018 With `-Z instrument-coverage`, coverage reporting of dead blocks (for example, blocks dropped because a conditional branch is dropped, based on const evaluation) is now supported. Note, this PR relands an earlier, reverted PR that failed when compiling generators. The prior issues with generators has been resolved and a new test was added to prevent future regressions. Check out the resulting changes to test coverage of dead blocks in the test coverage reports in this PR.
2021-05-11Revert "Auto merge of #84797 - richkadel:cover-unreachable-statements, ↵Rich Kadel-37/+5
r=tmandry" This reverts commit e5f83d24aee866a14753a7cedbb4e301dfe5bef5, reversing changes made to ac888e8675182c703c2cd097957878faf88dad94.
2021-05-01Report coverage `0` of dead blocksRich Kadel-5/+37
Fixes: #84018 With `-Z instrument-coverage`, coverage reporting of dead blocks (for example, blocks dropped because a conditional branch is dropped, based on const evaluation) is now supported. If `instrument-coverage` is enabled, `simplify::remove_dead_blocks()` finds all dropped coverage `Statement`s and adds their `code_region`s as `Unreachable` coverage `Statement`s to the `START_BLOCK`, so they are still included in the coverage map. Check out the resulting changes in the test coverage reports in this PR.
2021-03-23Auto merge of #83177 - erikdesjardins:zstassign, r=oli-obkbors-52/+27
Remove assignments to ZST places instead of marking ZST return place as unused partially reverts #83118 requested by `@tmiasko` in https://github.com/rust-lang/rust/pull/83118#issuecomment-799692574 r? `@oli-obk`
2021-03-20Extend comment in `UsedLocals::visit_lhs`Tomasz Miąsko-1/+3
2021-03-15revert changes from #83118 to mark zst return place as unusedErik Desjardins-52/+27
2021-03-14remove unnecessary conditionErik Desjardins-3/+1
`_local` isn't visited in `_local = <rhs>` statements in the situation we care about
2021-03-13Move ZST check inside UsedLocalsSimon Vandel Sillesen-50/+53
2021-03-13Extend SimplifyLocals to remove ZST writesSimon Vandel Sillesen-3/+27
2021-03-09Update interpret stepkadmin-0/+1
2021-02-24Auto merge of #80475 - simonvandel:fix-77355, r=oli-obkbors-17/+20
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-23Rollup merge of #82091 - henryboisdequin:use-place-ref-more, r=RalfJungDylan DPC-2/+1
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-22New mir-opt pass to simplify gotos with const valuesSimon Vandel Sillesen-17/+20
Fixes #77355
2021-02-20make `super_projection` take a `PlaceRef`Henry Boisdequin-2/+1
2021-01-28Avoid memory allocation when removing dead blocksTomasz Miąsko-7/+6
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-17Avoid logging the whole MIR body in SimplifyCfgTomasz Miąsko-1/+1
2020-10-26simplify-locals: Remove unused assignments regardless of rvalue kindTomasz Miąsko-25/+1
2020-10-26simplify-locals: Remove unused set-discriminant statementsTomasz Miąsko-5/+9
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-26simplify-locals: Change RemoveStatements visitor into a functionTomasz Miąsko-42/+31
No functionl changes intended.
2020-10-26simplify-locals: Unify use count visitorsTomasz Miąsko-113/+111
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-26simplify-locals: Represent use counts with u32Tomasz Miąsko-6/+6
2020-10-04Remember the `MirSource` for each `Body`Dylan MacKenzie-4/+4
2020-09-18use matches!() macro for simple if let conditionsMatthias Krüger-2/+1
2020-08-30mv compiler to compiler/mark-0/+547