about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform
AgeCommit message (Collapse)AuthorLines
2023-05-17Do not clone dominator tree for SSA analysis.Camille GILLOT-11/+8
2023-05-17Drive-by cleanup: `debug::term_type` => `TerminatorKind::name`Maybe Waffle-32/+9
2023-05-17Merge DominatorTree and Dominators.Camille GILLOT-17/+8
2023-05-17Cache dominators.Camille GILLOT-2/+5
2023-05-17Preprocess dominator tree to answer queries in O(1)Tomasz Miąsko-30/+24
2023-05-16Auto merge of #111556 - cjgillot:copy-prop-nrvo, r=oli-obkbors-42/+50
Merge return place with other locals in CopyProp. This reintroduces a limited form of NRVO. r? wg-mir-opt
2023-05-16Rollup merge of #111533 - clubby789:drop-tracking-error, r=oli-obkMatthias Krüger-2/+3
Handle error body in generator layout Fixes #111468 I feel like making this query return `Option<GeneratorLayout>` might be better but had some issues with that approach
2023-05-15Profile MIR passes.Camille GILLOT-6/+6
2023-05-15Move expansion of query macros in rustc_middle to rustc_middle::queryJohn Kåre Alsaker-5/+5
2023-05-14Stop turning transmutes into discriminants in mir-optScott McMurray-13/+0
Partially reverts 109612, as after 109993 these aren't actually equivalent any more, and I'm no longer confident this was ever an improvement in the first place.
2023-05-14Simplify implementation.Camille GILLOT-22/+16
2023-05-14Merge return place with other locals in CopyProp.Camille GILLOT-20/+34
2023-05-14Auto merge of #111517 - lukas-code:addr-of-mutate, r=tmiaskobors-17/+17
allow mutating function args through `&raw const` Fixes https://github.com/rust-lang/rust/issues/111502 by "turning off the sketchy optimization while we figure out if this is ok", like `@JakobDegen` said. The first commit in this PR removes some suspicious looking logic from the same method, but should have no functional changes, since it doesn't modify the `context` outside of the method. Best reviewed commit by commit. r? opsem
2023-05-13Handle error body when in generator layoutclubby789-2/+3
2023-05-13Do not ICE on deeply nested borrows.Camille GILLOT-2/+4
2023-05-13Iterate ReferencePropagation to fixpoint.Camille GILLOT-2/+4
2023-05-13Implement references VarDebugInfo.Camille GILLOT-0/+19
2023-05-13allow mutating function args through `&raw const`Lukas Markeffsky-5/+16
2023-05-12remove no-op logicLukas Markeffsky-13/+2
2023-05-12Rollup merge of #111441 - cjgillot:issue-111422, r=JakobDegenMatthias Krüger-30/+60
Verify copies of mutable pointers in 2 stages in ReferencePropagation Fixes #111422 In the first stage, we mark the copies as reborrows, to be checked later. In the second stage, we walk the reborrow chains to verify that all stages are fully replacable. The replacement itself mirrors the check, and iterates through the reborrow chain. r? ``````@RalfJung`````` cc ``````@JakobDegen``````
2023-05-11Rollup merge of #111432 - cjgillot:issue-111426, r=oli-obkMatthias Krüger-7/+13
Use visit_assign to detect SSA locals. I screwed up the logic in 3c43b61b870add2daddbd8e480477e5a8aa409c2. Fixes https://github.com/rust-lang/rust/issues/111426
2023-05-10Auto merge of #110820 - cjgillot:faster-dcp, r=oli-obkbors-17/+17
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-10Avoid shadowing.Camille GILLOT-2/+2
2023-05-10Do not see through copies of mutable pointers.Camille GILLOT-5/+6
2023-05-10Iteratively replace pointers.Camille GILLOT-25/+54
2023-05-10don't inline polymorphic adt instances whose fields contain projectionsb-naber-1/+26
in DropGlue.
2023-05-10Use visit_assign to detect SSA locals.Camille GILLOT-7/+13
2023-05-09Correct StorageLive comment.Camille GILLOT-2/+1
2023-05-09Only check storage liveness for direct projections.Camille GILLOT-6/+3
2023-05-09Do not check StorageLive dominates address-taking.Camille GILLOT-41/+75
2023-05-09Only check that StorageLive dominates address-taking.Camille GILLOT-4/+1
2023-05-09Explicit performance concern.Camille GILLOT-2/+2
2023-05-09Do not consider borrowed Freeze locals as SSA.Camille GILLOT-29/+34
2023-05-09Implement SSA-based reference propagation.Camille GILLOT-43/+417
2023-05-09Extract handle_set_discriminant.Camille GILLOT-15/+15
2023-05-09Make HasTop and HasBottom consts.Camille GILLOT-2/+2
2023-05-08Auto merge of #111358 - compiler-errors:rollup-yv27vrp, r=compiler-errorsbors-198/+452
Rollup of 6 pull requests Successful merges: - #104070 (Prevent aborting guard from aborting the process in a forced unwind) - #109410 (Introduce `AliasKind::Inherent` for inherent associated types) - #111004 (Migrate `mir_transform` to translatable diagnostics) - #111118 (Suggest struct when we get colon in fileds in enum) - #111170 (Diagnostic args are still args if they're documented) - #111354 (Fix miscompilation when calling default methods on `Future`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-05-08Auto merge of #111007 - JakobDegen:nrvo, r=tmiaskobors-1/+2
Disable nrvo mir opt See #111005 and #110902 . The ICE can definitely be hit on stable, the miscompilation I'm not sure about. The pass makes some pretty sketchy assumptions though, and we should not have it on while that's the case. I'm not going to work on actually fixing this, it's probably not excessively difficult though. r? rust-lang/mir-opt
2023-05-08Rollup merge of #111004 - clubby789:migrate-mir-transform, r=oli-obkMichael Goulet-198/+452
Migrate `mir_transform` to translatable diagnostics cc #100717
2023-05-08Auto merge of #110824 - cjgillot:const-prop-index, r=JakobDegen,oli-obkbors-0/+18
ConstProp into PlaceElem::Index. Noticed this while looking at keccak output MIR. This pass aims to replace `ProjectionElem::Index` with `ProjectionElem::ConstantIndex` during ConstProp. r? `@ghost`
2023-05-08Disable nrvo mir optJakob Degen-1/+2
2023-05-08Rollup merge of #110297 - kylematsuda:earlybinder_tcx_subst, r=BoxyUwUDylan DPC-5/+13
Make `(try_)subst_and_normalize_erasing_regions` take `EarlyBinder` Changes `subst_and_normalize_erasing_regions` and `try_subst_and_normalize_erasing_regions` to take `EarlyBinder<T>` instead of `T`. (related to #105779) This was suggested by `@BoxyUwU` in https://github.com/rust-lang/rust/pull/107753#discussion_r1105828139. After changing `type_of` to return `EarlyBinder`, there were several places where the binder was immediately skipped to call `tcx.subst_and_normalize_erasing_regions`, only for the binder to be reconstructed inside of that method. r? `@BoxyUwU`
2023-05-07Propagate PlaceElem::Index.Camille GILLOT-0/+18
2023-05-06make subst_mir take EarlyBinderKyle Matsuda-3/+7
2023-05-06use EarlyBinder in tcx.(try_)subst_mir_and_normalize_erasing_regionsKyle Matsuda-2/+6
2023-05-06Rename InstCombine to InstSimplifyBen Kimock-29/+29
2023-05-04Reject borrows of projections in ConstProp.Camille GILLOT-5/+15
2023-05-04Rollup merge of #110826 - cjgillot:place-mention-use, r=JakobDegen,lcnrMatthias Krüger-0/+1
Make PlaceMention a non-mutating use. Fixes https://github.com/rust-lang/rust/issues/110781 r? `@JakobDegen` I don't agree with your statement in https://github.com/rust-lang/rust/issues/110781#issuecomment-1520841434. I suggest that we start fixing `PlaceContext` to be accurate enough for optimizations to use it. This structure is very convenient to use in visitors, and we perhaps have an opportunity to make it less of a footgun.
2023-05-03Work around `rust-analyzer` false-positive type errorsZalathar-2/+2
2023-05-03Restrict `From<S>` for `{D,Subd}iagnosticMessage`.Nicholas Nethercote-5/+4
Currently a `{D,Subd}iagnosticMessage` can be created from any type that impls `Into<String>`. That includes `&str`, `String`, and `Cow<'static, str>`, which are reasonable. It also includes `&String`, which is pretty weird, and results in many places making unnecessary allocations for patterns like this: ``` self.fatal(&format!(...)) ``` This creates a string with `format!`, takes a reference, passes the reference to `fatal`, which does an `into()`, which clones the reference, doing a second allocation. Two allocations for a single string, bleh. This commit changes the `From` impls so that you can only create a `{D,Subd}iagnosticMessage` from `&str`, `String`, or `Cow<'static, str>`. This requires changing all the places that currently create one from a `&String`. Most of these are of the `&format!(...)` form described above; each one removes an unnecessary static `&`, plus an allocation when executed. There are also a few places where the existing use of `&String` was more reasonable; these now just use `clone()` at the call site. As well as making the code nicer and more efficient, this is a step towards possibly using `Cow<'static, str>` in `{D,Subd}iagnosticMessage::{Str,Eager}`. That would require changing the `From<&'a str>` impls to `From<&'static str>`, which is doable, but I'm not yet sure if it's worthwhile.