about summary refs log tree commit diff
path: root/compiler/rustc_mir/src/dataflow
AgeCommit message (Collapse)AuthorLines
2021-09-07Move the dataflow framework to its own crate.Camille GILLOT-6221/+0
2021-09-07Move rustc_mir::transform to rustc_mir_transform.Camille GILLOT-7/+11
2021-09-07Move rustc_mir::borrow_check to new crate rustc_borrowck.Camille GILLOT-466/+18
2021-08-21Remove `Session.used_attrs` and move logic to `CheckAttrVisitor`Aaron Hill-3/+3
Instead of updating global state to mark attributes as used, we now explicitly emit a warning when an attribute is used in an unsupported position. As a side effect, we are to emit more detailed warning messages (instead of just a generic "unused" message). `Session.check_name` is removed, since its only purpose was to mark the attribute as used. All of the callers are modified to use `Attribute.has_name` Additionally, `AttributeType::AssumedUsed` is removed - an 'assumed used' attribute is implemented by simply not performing any checks in `CheckAttrVisitor` for a particular attribute. We no longer emit unused attribute warnings for the `#[rustc_dummy]` attribute - it's an internal attribute used for tests, so it doesn't mark sense to treat it as 'unused'. With this commit, a large source of global untracked state is removed.
2021-08-17Fix bug in fmt_diff_withWill Crichton-1/+1
2021-08-17Expose graphviz modulesWill Crichton-2/+2
2021-07-04re-export SwitchIntEdgeEffectsTomasz Miąsko-1/+1
This makes it possible to use `switch_int_edge_effects` outside `rustc_mir::dataflow::impls`.
2021-06-02Add `Ty::is_union` predicate and use itTomasz Miąsko-4/+2
2021-05-13removed compilation errorayushmishra2005-1/+1
2021-05-13Miner code formattingayushmishra2005-4/+1
2021-04-19fix few typosklensy-1/+1
2021-04-07Rollup merge of #83916 - Amanieu:asm_anonconst, r=petrochenkovDylan DPC-2/+3
Use AnonConst for asm! constants This replaces the old system which used explicit promotion. See #83169 for more background. The syntax for `const` operands is still the same as before: `const <expr>`. Fixes #83169 Because the implementation is heavily based on inline consts, we suffer from the same issues: - We lose the ability to use expressions derived from generics. See the deleted tests in `src/test/ui/asm/const.rs`. - We are hitting the same ICEs as inline consts, for example #78174. It is unlikely that we will be able to stabilize this before inline consts are stabilized.
2021-04-06Use AnonConst for asm! constantsAmanieu d'Antras-2/+3
2021-04-02Reduce size of statementsRoxane-2/+2
2021-03-27Remove (lots of) dead codeJoshua Nelson-4/+0
Found with https://github.com/est31/warnalyzer. Dubious changes: - Is anyone else using rustc_apfloat? I feel weird completely deleting x87 support. - Maybe some of the dead code in rustc_data_structures, in case someone wants to use it in the future? - Don't change rustc_serialize I plan to scrap most of the json module in the near future (see https://github.com/rust-lang/compiler-team/issues/418) and fixing the tests needed more work than I expected. TODO: check if any of the comments on the deleted code should be kept.
2021-03-26Use iter::zip in compiler/Josh Stone-4/+7
2021-03-09Clean up todoskadmin-6/+3
Also add some span_bugs where it is unreachable
2021-03-09Update match brancheskadmin-0/+6
This updates all places where match branches check on StatementKind or UseContext. This doesn't properly implement them, but adds TODOs where they are, and also adds some best guesses to what they should be in some cases.
2021-03-05Shrink the size of Rvalue by 16 bytesOli Scherer-2/+2
2021-02-26Auto merge of #78429 - casey:doctest-attribute-splitting, r=jyn514bors-2/+2
[librustdoc] Only split lang string on `,`, ` `, and `\t` Split markdown lang strings into tokens on `,`. The previous behavior was to split lang strings into tokens on any character that wasn't a `_`, `_`, or alphanumeric. This is a potentially breaking change, so please scrutinize! See discussion in #78344. I noticed some test cases that made me wonder if there might have been some reason for the original behavior: ``` t("{.no_run .example}", false, true, Ignore::None, true, false, false, false, v(), None); t("{.sh .should_panic}", true, false, Ignore::None, false, false, false, false, v(), None); t("{.example .rust}", false, false, Ignore::None, true, false, false, false, v(), None); t("{.test_harness .rust}", false, false, Ignore::None, true, true, false, false, v(), None); ``` It seemed pretty peculiar to specifically test lang strings in braces, with all the tokens prefixed by `.`. I did some digging, and it looks like the test cases were added way back in [this commit from 2014](https://github.com/rust-lang/rust/commit/3fef7a74ca9a) by `@skade.` It looks like they were added just to make sure that the splitting was permissive, and aren't testing that those strings in particular are accepted. Closes https://github.com/rust-lang/rust/issues/78344.
2021-02-23Rollup merge of #82091 - henryboisdequin:use-place-ref-more, r=RalfJungDylan DPC-1/+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-16make `visit_projection` take a `PlaceRef`Henry Boisdequin-1/+1
2021-02-12[librustdoc] Reform lang string token splittingCasey Rodarmor-2/+2
Only split doctest lang strings on `,`, ` `, and `\t`. Additionally, to preserve backwards compatibility with pandoc-style langstrings, strip a surrounding `{}`, and remove leading `.`s from each token. Prior to this change, doctest lang strings were split on all non-alphanumeric characters except `-` or `_`, which limited future extensions to doctest lang string tokens, for example using `=` for key-value tokens. This is a breaking change, although it is not expected to be disruptive, because lang strings using separators other than `,` and ` ` are not very common
2021-02-08Remove RCs from BorrowsDániel Buga-11/+6
2021-02-07Optimize BorrowsDániel Buga-81/+89
Reuse as much memory as possible, reduce number of allocations. Use BitSet instead of a HashMap, since only a single bit of information was used as the map's value.
2021-01-16Use PlaceRef more consistently in rustc_mirOlivia Crain-7/+3
2020-12-18Switch compiler/ to intra-doc linksJoshua Nelson-1/+1
rustc_lint and rustc_lint_defs weren't switched because they're included in the compiler book and so can't use intra-doc links.
2020-11-16compiler: fold by valueBastian Kauschke-1/+1
2020-11-09Add comments to explain memory usage optimizationCamelid-1/+8
2020-10-28Fix typosDániel Buga-3/+3
2020-10-14Remove unused code from remaining compiler cratesest31-9/+0
2020-10-11Use SmallVec in SwitchTargetsJonas Schievink-1/+1
This allows building common SwitchTargets (eg. for `if`s) without allocation.
2020-10-10Refactor how SwitchInt stores jump targetsJonas Schievink-10/+8
2020-10-05Print to `stderr` when a graphviz file can't be writtenDylan MacKenzie-1/+1
`warn` prints nothing by default
2020-10-05Use MIR dump interface for dataflowDylan MacKenzie-23/+23
2020-10-05Auto merge of #77552 - ecstatic-morse:body-def-id, r=lcnrbors-49/+17
Replace `(Body, DefId)` with `Body` where possible Follow-up to #77430. I `grep`-ed for parameter lists in which a `Body` appeared within a few lines of a `DefId`, so it's possible that I missed some cases, but this should be pretty complete. Most of these changes were mechanical, but there's a few places where I started calling things "caller" and "callee" when multiple `DefId`s were in-scope at once. Also, we should probably have a helper function on `Body` that returns a `LocalDefId`. I can do that in this PR or in a follow-up.
2020-10-04Replace `(Body, DefId)` with `Body` where possibleDylan MacKenzie-49/+17
A `Body` now contains its `MirSource`, which in turn contains the `DefId` of the item associated with the `Body`.
2020-10-04Fix rebase falloutAaron Hill-1/+1
2020-10-04Address review commentsMatthew Jasper-2/+6
2020-10-04Reduce the number of drop-flag assignments in unwind pathsMatthew Jasper-4/+1
2020-10-01Add `-Zprecise-enum-drop-elaboration`Dylan MacKenzie-0/+8
Its purpose is to assist in debugging #77382 and #74551.
2020-09-26Remove intra-doc linkDylan MacKenzie-1/+1
2020-09-26Update dataflow impls to reflect new interfaceDylan MacKenzie-33/+116
2020-09-26Update engine to use new interfaceDylan MacKenzie-78/+68
2020-09-26Replace `discriminant_switch_effect` with more general versionDylan MacKenzie-21/+44
...that allows arbitrary effects on each edge of a `SwitchInt` terminator.
2020-09-26Remove unused #[allow(...)] statements from compiler/est31-1/+0
2020-09-25Rollup merge of #76724 - ecstatic-morse:dataflow-pass-names, r=lcnrJonas Schievink-2/+20
Allow a unique name to be assigned to dataflow graphviz output Previously, if the same analysis were invoked multiple times in a single compilation session, the graphviz output for later runs would overwrite that of previous runs. Allow callers to add a unique identifier to each run so this can be avoided.
2020-09-20Rollup merge of #76818 - hbina:dont_compile_regex_all_the_time, r=ecstatic-morseRalf Jung-1/+9
Don't compile regex at every function call. Use `SyncOnceCell` to only compile it once. I believe this still adds some kind of locking mechanism? Related issue: https://github.com/rust-lang/rust/issues/76817
2020-09-20Auto merge of #72632 - jonas-schievink:dest-prop, r=oli-obkbors-1/+1
Implement a generic Destination Propagation optimization on MIR This takes the work that was originally started by `@eddyb` in https://github.com/rust-lang/rust/pull/47954, and then explored by me in https://github.com/rust-lang/rust/pull/71003, and implements it in a general (ie. not limited to acyclic CFGs) and dataflow-driven way (so that no additional infrastructure in rustc is needed). The pass is configured to run at `mir-opt-level=2` and higher only. To enable it by default, some followup work on it is still needed: * Performance needs to be evaluated. I did some light optimization work and tested against `tuple-stress`, which caused trouble in my last attempt, but didn't go much in depth here. * We can also enable the pass only at `opt-level=2` and higher, if it is too slow to run in debug mode, but fine when optimizations run anyways. * Debuginfo needs to be fixed after locals are merged. I did not look into what is required for this. * Live ranges of locals (aka `StorageLive` and `StorageDead`) are currently deleted. We either need to decide that this is fine, or if not, merge the variable's live ranges (or remove these statements entirely – https://github.com/rust-lang/rust/issues/68622). Some benchmarks of the pass were done in https://github.com/rust-lang/rust/pull/72635.
2020-09-19Rollup merge of #76757 - matthiaskrgr:clippy_try_into, r=lcnrRalf Jung-7/+1
don't convert types to the same type with try_into (clippy::useless_conversion)