about summary refs log tree commit diff
path: root/src/librustc_mir/dataflow/impls
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-1867/+0
2020-08-18Moved coverage counter injection from BasicBlock to Statement.Rich Kadel-0/+3
2020-08-09rustc_mir: use IndexMap in BorrowSetJosh Stone-7/+7
2020-06-30Handle inactive enum variants in `MaybeUninitializedPlaces`Dylan MacKenzie-23/+48
2020-06-26Handle stores to projections correctly in liveness analysisDylan MacKenzie-2/+25
Previously, we were too conservative and `x.field = 4` was treated as a "use" of `x`.
2020-06-21Make is_freeze and is_copy_modulo_regions take TyCtxtAtRalf Jung-1/+1
2020-06-16rename location field of Drop terminators to placeRalf Jung-2/+2
2020-06-08Revert #71956Dylan MacKenzie-8/+234
2020-06-07rename FalseEdges -> FalseEdgeRalf Jung-1/+1
2020-05-30Make TLS accesses explicit in MIROliver Scherer-0/+1
2020-05-19Document assumptions made in generator transform for analysesDylan MacKenzie-0/+6
The generator transform needs to inspect all possible dataflow states. This can be done with half the number of bitset union operations if we can assume that the relevant analyses do not use "before" effects.
2020-05-19Remove `MaybeRequiresStorage`Dylan MacKenzie-234/+2
2020-05-19Add `MaybeInitializedLocals` dataflow analysisDylan MacKenzie-0/+117
2020-05-18Add asm! to MIRAmanieu d'Antras-3/+31
2020-05-08Rollup merge of #71993 - ecstatic-morse:cleanup-old-liveness, r=jonas-schievinkDylan DPC-0/+7
Remove old `util/liveness.rs` module The liveness dataflow analysis now lives in the `dataflow` module, so this one is no longer necessary. I've copied the relevant bits of the module docs for `util::liveness` to `MaybeLiveLocals`. The example in the docs is now a `mir-dataflow` test: https://github.com/rust-lang/rust/blob/a08c47310c7d49cbdc5d7afb38408ba519967ecd/src/test/ui/mir-dataflow/liveness-ptr.rs#L6-L26 The borrow-checker used the same notion of "defs" and "uses", so I've moved it into a submodule. I would have moved it to `util/def_use.rs`, since it seems generally useful, but there's already a slightly [different version](https://github.com/rust-lang/rust/blob/master/src/librustc_mir/util/def_use.rs) of the same abstraction needed for copy propagation.
2020-05-07Incorporate old module docs into `MaybeLiveLocals` docsDylan MacKenzie-0/+7
2020-05-04Export dataflow impls by nameDylan MacKenzie-4/+4
2020-05-03Live variable analysisDylan MacKenzie-0/+139
2020-05-03Support backward dataflow analysesDylan MacKenzie-2/+2
2020-04-22Use `Body` everywhereDylan MacKenzie-2/+2
2020-04-09Make `MaybeStorageLive` correct for all kinds of MIR bodiesDylan MacKenzie-5/+17
Before, it ignored the first argument and marked all variables without `Storage*` annotations as dead.
2020-04-02nix rustc_target::abi::* reexport in ty::layoutMazdak Farrokhzad-1/+1
2020-03-31Use Place directly on Operand::place and friends, it's CopySantiago Pastorino-10/+10
2020-03-31Use Place directly, it's Copy even more use casesSantiago Pastorino-9/+9
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-12/+9
(clippy::single_match) Makes code more compact and reduces nestig.
2020-03-30rustc -> rustc_middle part 3 (rustfmt)Mazdak Farrokhzad-2/+2
2020-03-30rustc -> rustc_middle part 2Mazdak Farrokhzad-11/+11
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-27Auto merge of #68404 - Amanieu:llvm-asm, r=estebankbors-2/+2
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-26Update imports from `dataflow::generic` to `dataflow`Dylan MacKenzie-7/+6
2020-03-26Rename asm! to llvm_asm!Amanieu d'Antras-2/+2
asm! is left as a wrapper around llvm_asm! to maintain compatibility.
2020-03-06Model generator resumption in dataflowJonas Schievink-2/+16
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-01Auto merge of #69295 - ecstatic-morse:unified-dataflow-generators, r=tmandrybors-88/+105
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-02-29use .iter() instead of .into_iter() on references.Matthias Krüger-1/+1
2020-02-27Rename `RequiresStorage` to `MaybeRequiresStorage`Dylan MacKenzie-7/+7
...to be consistent with the naming of other dataflow analyses.
2020-02-27Port `RequiresStorage` to new dataflow frameworkDylan MacKenzie-51/+70
2020-02-27Port `MaybeStorageLive` to new dataflow frameworkDylan MacKenzie-33/+31
2020-02-27Auto merge of #68528 - ecstatic-morse:maybe-init-variants, r=oli-obkbors-2/+35
Mark other variants as uninitialized after switch on discriminant During drop elaboration, which builds the drop ladder that handles destruction during stack unwinding, we attempt to remove MIR `Drop` terminators that will never be reached in practice. This reduces the number of basic blocks that are passed to LLVM, which should improve performance. In #66753, a user pointed out that unreachable `Drop` terminators are common in functions like `Option::unwrap`, which move out of an `enum`. While discussing possible remedies for that issue, @eddyb suggested moving const-checking after drop elaboration. This would allow the former, which looks for `Drop` terminators and replicates a small amount of drop elaboration to determine whether a dropped local has been moved out, leverage the work done by the latter. However, it turns out that drop elaboration is not as precise as it could be when it comes to eliminating useless drop terminators. For example, let's look at the code for `unwrap_or`. ```rust fn unwrap_or<T>(opt: Option<T>, default: T) -> T { match opt { Some(inner) => inner, None => default, } } ``` `opt` never needs to be dropped, since it is either moved out of (if it is `Some`) or has no drop glue (if it is `None`), and `default` only needs to be dropped if `opt` is `Some`. This is not reflected in the MIR we currently pass to codegen. ![pasted_image](https://user-images.githubusercontent.com/29463364/73384403-109a0d80-4280-11ea-8500-0637b368f2dc.png) @eddyb also suggested the solution to this problem. When we switch on an enum discriminant, we should be marking all fields in other variants as definitely uninitialized. I implemented this on top of alongside a small optimization (split out into #68943) that suppresses drop terminators for enum variants with no fields (e.g. `Option::None`). This is the resulting MIR for `unwrap_or`. ![after](https://user-images.githubusercontent.com/29463364/73384823-e432c100-4280-11ea-84bd-d0bcc3b777b4.png) In concert with #68943, this change speeds up many [optimized and debug builds](https://perf.rust-lang.org/compare.html?start=d55f3e9f1da631c636b54a7c22c1caccbe4bf0db&end=0077a7aa11ebc2462851676f9f464d5221b17d6a). We need to carefully investigate whether I have introduced any miscompilations before merging this. Code that never drops anything would be very fast indeed until memory is exhausted.
2020-02-19Handle resume args in `RequiresStorage` analysisJonas Schievink-11/+46
2020-02-19Use match ergonomics to simplify matchJonas Schievink-5/+5
2020-02-19Match MIR statements exhaustivelyJonas Schievink-1/+8
2020-02-17Fix typo in commentDylan MacKenzie-1/+1
2020-02-17Use doc comment for explanation of `shared_borrow_allows_mutation`Dylan MacKenzie-9/+9
2020-02-13Kill move paths of dead variantsDylan MacKenzie-2/+35
2020-02-13Ignore mut borrow from drop terminator in const-evalDylan MacKenzie-12/+33
2020-02-13Rename `MaybeBorrowedLocals` constructorsDylan MacKenzie-2/+5
2020-02-12Use `MaybeBorrowedLocals` for generator analysesDylan MacKenzie-26/+20
It should have the same semantics as `HaveBeenBorrowedLocals`
2020-02-12Remove outdated `IndirectlyMutableLocals`Dylan MacKenzie-138/+0
`MaybeMutBorrowedLocals` serves the same purpose and has a better name.