about summary refs log tree commit diff
path: root/src/librustc_mir/dataflow
AgeCommit message (Collapse)AuthorLines
2020-04-02nix rustc_target::abi::* reexport in ty::layoutMazdak Farrokhzad-2/+2
2020-04-01Rollup merge of #70627 - spastorino:use-place-directly-its-copy, r=oli-obkMazdak Farrokhzad-65/+65
Use place directly its copy r? @oli-obk
2020-04-01Rollup merge of #70511 - ecstatic-morse:mir-dataflow-graphviz, r=davidtwcoMazdak Farrokhzad-1/+20
Add `-Z dump-mir-dataflow` flag for dumping dataflow results visualization Previously, to visualize the results of a MIR dataflow pass, one had to add a `#[rustc_mir(borrowck_graphviz_postflow)]` attribute to functions of interest. However, there is no way to specify this attribute on closures and generators, so it was impossible to view results for these MIR bodies. This PR adds a flag, `-Z dump-mir-dataflow`, which will output the dataflow results for any functions specified in `-Z dump-mir` to the output directory specified by `-Z dump-mir-dir`. This behavior is modeled on the `-Z dump-mir-graphviz` flag.
2020-03-31Use Place directly in apply_call_return_effect on framework/tests, it's CopySantiago Pastorino-1/+1
2020-03-31Use Place directly on place_contents_drop_state_cannot_differ, it's CopySantiago Pastorino-2/+2
2020-03-31Use Place directly on Operand::place and friends, it's CopySantiago Pastorino-28/+28
2020-03-31Use Place directly, it's Copy even more use casesSantiago Pastorino-28/+28
2020-03-31Use Place directly, it's CopySantiago Pastorino-6/+6
2020-03-30Use if let instead of match when only matching a single variant ↵Matthias Krüger-36/+30
(clippy::single_match) Makes code more compact and reduces nestig.
2020-03-30rustc -> rustc_middle part 3 (rustfmt)Mazdak Farrokhzad-17/+17
2020-03-30rustc -> rustc_middle part 2Mazdak Farrokhzad-32/+32
2020-03-29Use `&` to do deref coercion for `ReadOnlyBodyAndCache`Dylan MacKenzie-2/+2
2020-03-29Make `Visitor::visit_body` take a simple `Body`Dylan MacKenzie-1/+1
2020-03-28Ensure output dir for dataflow results existsDylan MacKenzie-0/+5
2020-03-28Dump graphviz dataflow results with flagDylan MacKenzie-1/+15
2020-03-27Auto merge of #68404 - Amanieu:llvm-asm, r=estebankbors-3/+3
Rename asm! to llvm_asm! As per https://github.com/rust-lang/rfcs/pull/2843, this PR renames `asm!` to `llvm_asm!`. It also renames the compiler's internal `InlineAsm` data structures to `LlvmInlineAsm` in preparation for the new `asm!` functionality specified in https://github.com/rust-lang/rfcs/pull/2850. This PR doesn't actually deprecate `asm!` yet, it just makes it redirect to `llvm_asm!`. This is necessary because we first need to update the submodules (in particular stdarch) to use `llvm_asm!`.
2020-03-26Make `framework` a private moduleDylan MacKenzie-1/+1
2020-03-26Update `framework` module docsDylan MacKenzie-17/+15
2020-03-26Move `BottomValue` into `framework/mod.rs`Dylan MacKenzie-47/+43
2020-03-26Update imports from `dataflow::generic` to `dataflow`Dylan MacKenzie-7/+6
2020-03-26Update use statements in `dataflow/mod.rs`Dylan MacKenzie-7/+10
2020-03-26Rename `dataflow::generic` to `dataflow::framework`Dylan MacKenzie-0/+0
2020-03-26Move `MoveDataParamEnv` to beginning of moduleDylan MacKenzie-5/+5
2020-03-26Remove `BitDenotation` frameworkDylan MacKenzie-1017/+2
2020-03-26Rename asm! to llvm_asm!Amanieu d'Antras-3/+3
asm! is left as a wrapper around llvm_asm! to maintain compatibility.
2020-03-23Rollup merge of #70269 - matthiaskrgr:clippy_closures, r=Dylan-DPCMazdak Farrokhzad-1/+1
remove redundant closures (clippy::redundant_closure)
2020-03-22remove redundant closures (clippy::redundant_closure)Matthias Krüger-1/+1
2020-03-22don't create variable bindings just to return the bound value immediately ↵Matthias Krüger-3/+2
(clippy::let_and_return)
2020-03-20remove redundant returns (clippy::needless_return)Matthias Krüger-2/+2
2020-03-16use direct imports for `rustc::{lint, session}`.Mazdak Farrokhzad-8/+6
2020-03-14Auto merge of #69716 - jonas-schievink:generator-size, r=tmandrybors-29/+86
Don't store locals in generators that are immediately overwritten with the resume argument This fixes https://github.com/rust-lang/rust/issues/69672 and makes https://github.com/rust-lang/rust/pull/69033 pass the async fn size tests again (in other words, there will be no size regression of async fn if both this and https://github.com/rust-lang/rust/pull/69033 land). ~~This is a small botch and I'd rather have a more precise analysis, but that seems much harder to pull off, so this special-cases `Yield` terminators that store the resume argument into a simple local (ie. without any field projections) and explicitly marks that local as "not live" in the suspend point of that yield. We know that this local does not need to be stored in the generator for this suspend point because the next resume would immediately overwrite it with the passed-in resume argument anyways. The local might still end up in the state if it is used across another yield.~~ (this now properly updates the dataflow framework to handle this case)
2020-03-10Rollup merge of #69714 - spastorino:place-ref-lifetime, r=oli-obkMazdak Farrokhzad-2/+2
Make PlaceRef take just one lifetime r? @eddyb
2020-03-07Auto merge of #69676 - ecstatic-morse:fix-enum-discr-effect, r=oli-obkbors-20/+28
Pass correct place to `discriminant_switch_effect` PR #69562, which fixed a bug that was causing clippy to ICE, mistakenly passed the place holding the *result* of `Rvalue::Discriminant` instead of the place holding its *operand* to `apply_discriminant_switch_effect` as the enum place. As a result, no effect was applied at all, and we lost the perf benefits from marking inactive enum variants as uninitialized. **edit:** The regression test has been split into #69744. r? @oli-obk
2020-03-06Don't redundantly repeat field names (clippy::redundant_field_names)Matthias Krüger-2/+2
2020-03-06Model generator resumption in dataflowJonas Schievink-29/+86
We now have a way to apply an effect only *after* a `yield` resumes, similar to calls (which can either return or unwind).
2020-03-05Rollup merge of #69736 - matthiaskrgr:even_more_clippy, r=Dylan-DPCDylan DPC-6/+6
even more clippy cleanups * Don't pass &mut where immutable reference (&) is sufficient (clippy::unnecessary_mut_passed) * Use more efficient &&str to String conversion (clippy::inefficient_to_string) * Don't always eval arguments inside .expect(), use unwrap_or_else and closure. (clippy::expect_fun_call) * Use righthand '&' instead of lefthand "ref". (clippy::toplevel_ref_arg) * Use simple 'for i in x' loops instead of 'while let Some(i) = x.next()' loops on iterators. (clippy::while_let_on_iterator) * Const items have by default a static lifetime, there's no need to annotate it. (clippy::redundant_static_lifetimes) * Remove redundant patterns when matching ( x @ _ to x) (clippy::redundant_pattern)
2020-03-05Don't pass &mut where immutable reference (&) is sufficient ↵Matthias Krüger-4/+4
(clippy::unnecessary_mut_passed)
2020-03-05Const items have by default a static lifetime, there's no need to annotate ↵Matthias Krüger-2/+2
it. (clippy::redundant_static_lifetimes)
2020-03-04PlaceRef<'a, 'tcx> -> PlaceRef<'tcx>Santiago Pastorino-2/+2
2020-03-04Make PlaceRef lifetimes of in_projection be both 'tcxSantiago Pastorino-1/+1
2020-03-04cover some more nearby casesRalf Jung-1/+0
2020-03-03Use correct place for `enum_place`Dylan MacKenzie-20/+28
PR #69562, which fixed a bug that was causing clippy to ICE, passed the place for the *result* of `Rvalue::Discriminant` instead of the *operand* to `apply_discriminant_switch_effect`. As a result, no effect was applied at all, and we lost the perf benefits from marking inactive enum variants as uninitialized.
2020-03-01Auto merge of #69606 - JohnTitor:rollup-i3nrrcf, r=JohnTitorbors-54/+72
Rollup of 7 pull requests Successful merges: - #69397 (bootstrap: Remove commit hash from LLVM version suffix to avoid rebuilds) - #69549 (Improve MinGW detection when cross compiling ) - #69562 (Don't `bug` when taking discriminant of generator during dataflow) - #69579 (parser: Remove `Parser::prev_span`) - #69580 (use .copied() instead of .map(|x| *x) on iterators) - #69583 (Do not ICE on invalid type node after parse recovery) - #69605 (Use `opt_def_id()` over `def_id()`) Failed merges: r? @ghost
2020-03-01Rollup merge of #69562 - ecstatic-morse:dataflow-generator-discriminant, ↵Yuki Okushi-54/+72
r=oli-obk Don't `bug` when taking discriminant of generator during dataflow The proper fix for rust-lang/rust-clippy#5239. `Rvalue::Discriminant` is used on generators as well as `enum`s. This didn't cause a test failure in `rustc` since we don't need to do any dataflow passes until after the generator transform that adds the `Rvalue::Discriminant`. This required a small refactoring. `diff -w` is beneficial. r? @oli-obk cc @JohnTitor
2020-03-01Auto merge of #69295 - ecstatic-morse:unified-dataflow-generators, r=tmandrybors-100/+124
Use new dataflow framework for generators #65672 introduced a new dataflow framework that can handle arbitrarily complex transfer functions as well as ones expressed as a series of gen/kill operations. This PR ports the analyses used to implement generators to the new framework so that we can remove the old one. See #68241 for a prior example of this. The new framework has some superficial API changes, but this shouldn't alter the generator passes in any way. r? @tmandry
2020-03-01Auto merge of #69592 - petrochenkov:nosyntax, r=Centrilbors-2/+2
Rename `libsyntax` to `librustc_ast` This was the last rustc crate that wasn't following the `rustc_*` naming convention. Follow-up to https://github.com/rust-lang/rust/pull/67763.
2020-02-29Rename `syntax` to `rustc_ast` in source codeVadim Petrochenkov-2/+2
2020-02-29use .iter() instead of .into_iter() on references.Matthias Krüger-2/+2
2020-02-28Don't bug when taking discriminant of generatorDylan MacKenzie-54/+72
2020-02-28remove redundant clones, references to operands, explicit boolean ↵Matthias Krüger-5/+1
comparisons and filter(x).next() calls.