Commit Graph

311 Commits

Author SHA1 Message Date
Camille GILLOT 4ad22b91fc Correct comment and assumption. 2023-09-07 15:45:25 +00:00
Camille GILLOT fc63543792 Support array length. 2023-09-06 16:05:04 +00:00
Camille GILLOT 7ef555d84a Support non-trivial scalars in ConstProp. 2023-09-05 21:25:41 +00:00
Jason Newcomb f686bd8949 Take `&mut Results` in `ResultsVisitor` 2023-09-02 19:35:51 -04:00
Ralf Jung 4c53783f3c when terminating during unwinding, show the reason why 2023-08-24 13:28:26 +02:00
Ralf Jung 818ec8e23a give some unwind-related terminators a more clear name 2023-08-20 15:52:38 +02:00
Camille GILLOT f5e4eb91b7 Use Terminator::edges for backward analysis too. 2023-08-16 19:40:46 +00:00
Camille GILLOT e9990ce89c Only evaluate yield place after resume in liveness. 2023-08-16 18:12:18 +00:00
Camille GILLOT 7ded3409b8 Specify that method only applies statement effects. 2023-08-16 18:12:18 +00:00
Camille GILLOT aa697f599e Rename YieldResumeEffect. 2023-08-16 18:12:18 +00:00
Camille GILLOT 388f6a6413 Make TerminatorEdge plural. 2023-08-16 18:12:18 +00:00
Camille GILLOT 6cf15d4cb5 Rename MaybeUnreachable. 2023-08-16 18:12:18 +00:00
Camille GILLOT f19cd3f2e1 Use TerminatorEdge for dataflow-const-prop. 2023-08-16 18:12:18 +00:00
Camille GILLOT 3acfa092db Only run MaybeInitializedPlaces once for drop elaboration. 2023-08-16 18:12:18 +00:00
Camille GILLOT 5173d85043 Allow apply_terminator_effect to customize edges. 2023-08-16 18:12:17 +00:00
Camille GILLOT 32711b2b4e Introduce MaybeUnreachable. 2023-08-16 18:12:17 +00:00
Camille GILLOT 934a99eb65 Move domain_size to GenKillAnalysis. 2023-08-16 18:12:17 +00:00
Camille GILLOT 8726cbc75f Move initialization dataflow impls into their own module. 2023-08-16 18:12:17 +00:00
Camille GILLOT 760881b29d Create bottom on-the-fly instead of cloning it. 2023-08-16 18:12:17 +00:00
Camille GILLOT 9c97abd54c Simplify for_each_mut_borrow. 2023-08-16 18:12:17 +00:00
Matthias Krüger 13de583583
Rollup merge of #114505 - ouz-a:cleanup_mir, r=RalfJung
Add documentation to has_deref

Documentation of `has_deref` needed some polish to be more clear about where it should be used and what's it's purpose.

cc https://github.com/rust-lang/rust/issues/114401

r? `@RalfJung`
2023-08-06 17:26:29 +02:00
ouz-a 6df546281b cleanup misinformation regarding has_deref 2023-08-06 17:29:09 +03:00
Michael Goulet 99969d282b Use upvar_tys in more places, make it a list 2023-08-01 23:19:31 +00:00
Matthias Krüger 3ce90b1649 inline format!() args up to and including rustc_codegen_llvm 2023-07-30 14:22:50 +02:00
Camille GILLOT f5feb3e3ca Turn copy into moves during DSE. 2023-07-19 09:59:12 +00:00
Mahdi Dibaiee e55583c4b8 refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
Mark Rousskov cc907f80b9 Re-format let-else per rustfmt update 2023-07-12 21:49:27 -04:00
bors 5b733e2bca Auto merge of #113316 - DrMeepster:underefer_perf, r=oli-obk
Rewrite `UnDerefer`, again

This PR is intended to improve the perf regression introduced by #112882.

`UnDerefer` has been separated out again for borrowck reasons. It was a bit overzealous to remove it in the previous PR.

r? `@oli-obk`
2023-07-11 06:52:53 +00:00
DrMeepster b0dbd60040 optimization round 2
- moved work from `find_local` to `gather_statement`
- created custom iterator for `iter_projections`
- reverted change from `IndexVec` to `FxIndexMap`
2023-07-10 20:46:01 -07:00
Boxy 12138b8e5e Move `TyCtxt::mk_x` to `Ty::new_x` where applicable 2023-07-05 20:27:07 +01:00
DrMeepster d1c9696b7d bring back un_derefer and rewrite it again 2023-07-04 13:45:23 -07:00
DrMeepster 4fbd6d5af4 Merge `un_derefer` into `MovePathLookup` 2023-06-29 22:14:27 -07:00
Florian Groult 3224ea4424 Export AnalysisResults trait in rustc_mir_dataflow 2023-06-27 11:35:32 +02:00
bors b9ad9b78a2 Auto merge of #112693 - ericmarkmartin:use-more-placeref, r=spastorino
Use PlaceRef abstractions more often

Associated issue: https://github.com/rust-lang/rust/issues/80647

r? `@spastorino`
2023-06-27 00:34:49 +00:00
Eric Mark Martin c07c10d1e4 use PlaceRef abstractions more consistently 2023-06-25 20:38:01 -04:00
Ziru Niu 8fb4c41f35 merge `BorrowKind::Unique` into `BorrowKind::Mut` 2023-06-20 20:55:31 +08:00
Michael Goulet 31d1fbf8d2
Rollup merge of #112232 - fee1-dead-contrib:match-eq-const-msg, r=b-naber
Better error for non const `PartialEq` call generated by `match`

Resolves #90237
2023-06-19 17:53:33 -07:00
bors c911e08514 Auto merge of #112617 - lqd:dump-mir-dataflow, r=tmiasko
make mir dataflow graphviz dumps opt-in

This should save some MIR traversals and allocations that are not really needed.

Small win but noticeable locally. Let's see what LTO/PGO say.

r? `@ghost`
2023-06-19 01:17:40 +00:00
Deadbeef 89c24af133 Better error for non const `PartialEq` call generated by `match` 2023-06-18 05:24:38 +00:00
DrMeepster a5c6cb888e remove box_free and replace with drop impl 2023-06-16 13:41:06 -07:00
Rémy Rakic 9395e2771a make mir dataflow graphviz dumps opt-in 2023-06-14 12:30:13 +00:00
bors 68c8fdaac0 Auto merge of #108293 - Jarcho:mut_analyses, r=eholk
Take MIR dataflow analyses by mutable reference

The main motivation here is any analysis requiring dynamically sized scratch memory to work. One concrete example would be pointer target tracking, where tracking the results of a dereference can result in multiple possible targets. This leads to processing multi-level dereferences requiring the ability to handle a changing number of potential targets per step. A (simplified) function for this would be `fn apply_deref(potential_targets: &mut Vec<Target>)` which would use the scratch space contained in the analysis to send arguments and receive the results.

The alternative to this would be to wrap everything in a `RefCell`, which is what `MaybeRequiresStorage` currently does. This comes with a small perf cost and loses the compiler's guarantee that we don't try to take multiple borrows at the same time.

For the implementation:
* `AnalysisResults` is an unfortunate requirement to avoid an unconstrained type parameter error.
* `CloneAnalysis` could just be `Clone` instead, but that would result in more work than is required to have multiple cursors over the same result set.
* `ResultsVisitor` now takes the results type on in each function as there's no other way to have access to the analysis without cloning it. This could use an associated type rather than a type parameter, but the current approach makes it easier to not care about the type when it's not necessary.
* `MaybeRequiresStorage` now no longer uses a `RefCell`, but the graphviz formatter now does. It could be removed, but that would require even more changes and doesn't really seem necessary.
2023-06-08 23:58:44 +00:00
lcnr cfd0623411 unique borrows are mutating uses 2023-05-29 17:15:48 +02:00
Guillaume Gomez ddb5424569
Rollup merge of #111952 - cjgillot:drop-replace, r=WaffleLapkin
Remove DesugaringKind::Replace.

A simple boolean flag is enough.
2023-05-27 13:38:31 +02:00
clubby789 f97fddab91 Ensure Fluent messages are in alphabetical order 2023-05-25 23:49:35 +00:00
Camille GILLOT 844c1cc5fe Remove DesugaringKind::Replace. 2023-05-25 17:40:46 +00:00
Jason Newcomb eaddc37075 Take MIR dataflow analyses by mutable reference. 2023-05-18 17:46:39 -04:00
Dylan DPC 828caa80a9
Rollup merge of #110930 - b-naber:normalize-elaborate-drops, r=cjgillot
Don't expect normalization to succeed in elaborate_drops

Fixes https://github.com/rust-lang/rust/issues/110682

This was exposed through the changes in https://github.com/rust-lang/rust/pull/109247, which causes more things to be inlined. Inlining can happen before monomorphization, so we can't expect normalization to succeed. In the elaborate_drops analysis we currently have [this call](033aa092ab/compiler/rustc_mir_dataflow/src/elaborate_drops.rs (L278)) to `normalize_erasing_regions`, which ICEs when normalization fails. The types are used to infer [whether the type needs a drop](033aa092ab/compiler/rustc_mir_dataflow/src/elaborate_drops.rs (L374)), where `needs_drop` itself [uses `try_normalize_erasing_regions`](033aa092ab/compiler/rustc_middle/src/ty/util.rs (L1121)).

~[`instance_mir`](https://doc.rust-lang.org/stable/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.instance_mir) isn't explicit about whether it expects the instances corresponding to the `InstanceDef`s to be monomorphized (though I think in all other contexts the function is used post-monomorphization), so the use of `instance_mir` in inlining doesn't necessarily seem wrong to me.~
2023-05-17 19:11:53 +05:30
bors 9a767b6b9e Auto merge of #110820 - cjgillot:faster-dcp, r=oli-obk
Optimize dataflow-const-prop place-tracking infra

Optimization opportunities found while investigating https://github.com/rust-lang/rust/pull/110719

Computing places breadth-first ensures that we create short projections before deep projections, since the former are more likely to be propagated.

The most relevant is the pre-computation of flooded places. Callgrind showed `flood_*` methods and especially `preorder_preinvoke` were especially hot. This PR attempts to pre-compute the set of `ValueIndex` that `preorder_invoke` would visit.

Using this information, we make some `PlaceIndex` inaccessible when they contain no `ValueIndex`, allowing to skip computations for those places.

cc `@jachris` as original author
2023-05-10 20:54:31 +00:00
b-naber e7a2f52ba1 don't inline polymorphic adt instances whose fields contain projections
in DropGlue.
2023-05-10 16:03:52 +00:00