about summary refs log tree commit diff
path: root/compiler/rustc_mir_dataflow/src
AgeCommit message (Collapse)AuthorLines
2024-08-18rename AddressOf -> RawBorrow inside the compilerRalf Jung-7/+7
2024-08-14Auto merge of #128812 - nnethercote:shrink-TyKind-FnPtr, r=compiler-errorsbors-2/+2
Shrink `TyKind::FnPtr`. By splitting the `FnSig` within `TyKind::FnPtr` into `FnSigTys` and `FnHeader`, which can be packed more efficiently. This reduces the size of the hot `TyKind` type from 32 bytes to 24 bytes on 64-bit platforms. This reduces peak memory usage by a few percent on some benchmarks. It also reduces cache misses and page faults similarly, though this doesn't translate to clear cycles or wall-time improvements on CI. r? `@compiler-errors`
2024-08-11Use assert_matches around the compilerMichael Goulet-3/+7
2024-08-09Shrink `TyKind::FnPtr`.Nicholas Nethercote-2/+2
By splitting the `FnSig` within `TyKind::FnPtr` into `FnSigTys` and `FnHeader`, which can be packed more efficiently. This reduces the size of the hot `TyKind` type from 32 bytes to 24 bytes on 64-bit platforms. This reduces peak memory usage by a few percent on some benchmarks. It also reduces cache misses and page faults similarly, though this doesn't translate to clear cycles or wall-time improvements on CI.
2024-07-29Stop using MoveDataParamEnv for places that don't need a param-envMichael Goulet-44/+32
2024-07-29Reformat `use` declarations.Nicholas Nethercote-65/+59
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-19Avoid ref when using format! in compilerYuri Astrakhan-1/+1
Clean up a few minor refs in `format!` macro, as it has a performance cost. Apparently the compiler is unable to inline `format!("{}", &variable)`, and does a run-time double-reference instead (format macro already does one level referencing). Inlining format args prevents accidental `&` misuse.
2024-07-14Stop using the gen keyword in the compilerMichael Goulet-36/+36
2024-07-13Propagate places through assignments.Camille GILLOT-10/+109
2024-07-13Create mapped places upon seeing them in the body.Camille GILLOT-122/+117
2024-07-07Support tail calls in mir via `TerminatorKind::TailCall`Maybe Waffle-0/+12
2024-07-03Auto merge of #127036 - cjgillot:sparse-state, r=oli-obkbors-75/+127
Make jump threading state sparse Continuation of https://github.com/rust-lang/rust/pull/127024 Both dataflow const-prop and jump threading involve cloning the state vector a lot. This PR replaces the data structure by a sparse vector, considering: - that jump threading state is typically very sparse (at most 1 or 2 set entries); - that dataflow const-prop is disabled by default; - that place/value map is very eager, and prone to creating an overly large state. The first commit is shared with the previous PR to avoid needless conflicts. r? `@oli-obk`
2024-07-01Make jump threading state sparse.Camille GILLOT-33/+72
2024-07-01Swap encapsulation of DCP state.Camille GILLOT-68/+81
2024-07-01Auto merge of #126996 - oli-obk:do_not_count_errors, r=nnethercotebors-23/+31
Automatically taint InferCtxt when errors are emitted r? `@nnethercote` Basically `InferCtxt::dcx` now returns a `DiagCtxt` that refers back to the `Cell<Option<ErrorGuaranteed>>` of the `InferCtxt` and thus when invoking `Diag::emit`, and the diagnostic is an error, we taint the `InferCtxt` directly. That change on its own has no effect at all, because `InferCtxt` already tracks whether errors have been emitted by recording the global error count when it gets opened, and checking at the end whether the count changed. So I removed that error count check, which had a bit of fallout that I immediately fixed by invoking `InferCtxt::dcx` instead of `TyCtxt::dcx` in a bunch of places. The remaining new errors are because an error was reported in another query, and never bubbled up. I think they are minor enough for this to be ok, and sometimes it actually improves diagnostics, by not silencing useful diagnostics anymore. fixes #126485 (cc `@olafes)` There are more improvements we can do (like tainting in hir ty lowering), but I would rather do that in follow up PRs, because it requires some refactorings.
2024-06-29Stop ICEing on impossible predicates.Camille GILLOT-2/+3
2024-06-26Split lifetimes on mir borrowck dataflowOli Scherer-23/+31
2024-06-21Save 2 pointers in `TerminatorKind` (96 → 80 bytes)Scott McMurray-6/+4
These things don't need to be `Vec`s; boxed slices are enough. The frequent one here is call arguments, but MIR building knows the number of arguments from the THIR, so the collect is always getting the allocation right in the first place, and thus this shouldn't ever add the shrink-in-place overhead.
2024-06-14Use is_lang_item more aggressivelyMichael Goulet-2/+1
2024-06-12Use `tidy` to sort crate attributes for all compiler crates.Nicholas Nethercote-0/+2
We already do this for a number of crates, e.g. `rustc_middle`, `rustc_span`, `rustc_metadata`, `rustc_span`, `rustc_errors`. For the ones we don't, in many cases the attributes are a mess. - There is no consistency about order of attribute kinds (e.g. `allow`/`deny`/`feature`). - Within attribute kind groups (e.g. the `feature` attributes), sometimes the order is alphabetical, and sometimes there is no particular order. - Sometimes the attributes of a particular kind aren't even grouped all together, e.g. there might be a `feature`, then an `allow`, then another `feature`. This commit extends the existing sorting to all compiler crates, increasing consistency. If any new attribute line is added there is now only one place it can go -- no need for arbitrary decisions. Exceptions: - `rustc_log`, `rustc_next_trait_solver` and `rustc_type_ir_macros`, because they have no crate attributes. - `rustc_codegen_gcc`, because it's quasi-external to rustc (e.g. it's ignored in `rustfmt.toml`).
2024-05-23Remove `#[macro_use] extern crate tracing` from `rustc_mir_dataflow`.Nicholas Nethercote-3/+7
2024-05-17Remove `Rvalue::CheckedBinaryOp`Scott McMurray-4/+1
2024-05-02Inline & delete `Ty::new_unit`, since it's just a field accessWaffle Lapkin-1/+1
2024-04-30Rollup merge of #124511 - nnethercote:rm-extern-crates, r=fee1-deadMatthias Krüger-2/+5
Remove many `#[macro_use] extern crate foo` items This requires the addition of more `use` items, which often make the code more verbose. But they also make the code easier to read, because `#[macro_use]` obscures where macros are defined. r? `@fee1-dead`
2024-04-29Rollup merge of #124185 - beepster4096:move_data_base_local_infallible, ↵Matthias Krüger-10/+5
r=pnkfelix Remove optionality from MoveData::base_local This is an artifact from when Places could be based on statics and not just locals. Now, all move paths either are locals or have parents, so this doesn't need to return Option anymore.
2024-04-29Remove `extern crate rustc_middle` from numerous crates.Nicholas Nethercote-2/+5
2024-04-20Add a non-shallow fake borrowNadrieril-1/+1
2024-04-19remove optionality from MoveData::base_localbeepster4096-10/+5
2024-04-08Actually create ranged int types in the type system.Oli Scherer-0/+2
2024-04-03rustc_index: Add a `ZERO` constant to index typesVadim Petrochenkov-5/+5
It is commonly used.
2024-03-23refactor check_{lang,library}_ub: use a single intrinsic, put policy into ↵Ralf Jung-1/+1
library
2024-03-22Programmatically convert some of the pat ctorsMichael Goulet-2/+2
2024-03-22Eagerly convert some ctors to use their specialized ctorsMichael Goulet-7/+2
2024-03-20step cfgsMark Rousskov-1/+0
2024-03-08Distinguish between library and lang UB in assert_unsafe_preconditionBen Kimock-1/+1
2024-03-08Rollup merge of #119365 - nbdd0121:asm-goto, r=AmanieuMatthias Krüger-9/+16
Add asm goto support to `asm!` Tracking issue: #119364 This PR implements asm-goto support, using the syntax described in "future possibilities" section of [RFC2873](https://rust-lang.github.io/rfcs/2873-inline-asm.html#asm-goto). Currently I have only implemented the `label` part, not the `fallthrough` part (i.e. fallthrough is implicit). This doesn't reduce the expressive though, since you can use label-break to get arbitrary control flow or simply set a value and rely on jump threading optimisation to get the desired control flow. I can add that later if deemed necessary. r? ``@Amanieu`` cc ``@ojeda``
2024-03-04Return a struct from `query intrinsic` to be able to add another field in ↵Oli Scherer-1/+1
the next commit
2024-02-24Implement asm goto in MIR and MIR loweringGary Guo-2/+4
2024-02-24Change InlineAsm to allow multiple targets insteadGary Guo-7/+12
2024-02-16Auto merge of #120500 - oli-obk:intrinsics2.0, r=WaffleLapkinbors-2/+1
Implement intrinsics with fallback bodies fixes #93145 (though we can port many more intrinsics) cc #63585 The way this works is that the backend logic for generating custom code for intrinsics has been made fallible. The only failure path is "this intrinsic is unknown". The `Instance` (that was `InstanceDef::Intrinsic`) then gets converted to `InstanceDef::Item`, which represents the fallback body. A regular function call to that body is then codegenned. This is currently implemented for * codegen_ssa (so llvm and gcc) * codegen_cranelift other backends will need to adjust, but they can just keep doing what they were doing if they prefer (though adding new intrinsics to the compiler will then require them to implement them, instead of getting the fallback body). cc `@scottmcm` `@WaffleLapkin` ### todo * [ ] miri support * [x] default intrinsic name to name of function instead of requiring it to be specified in attribute * [x] make sure that the bodies are always available (must be collected for metadata)
2024-02-13Rollup merge of #120802 - oli-obk:drop_elab_ice, r=compiler-errorsMatthias Krüger-1/+4
Bail out of drop elaboration when encountering error types fixes #120788
2024-02-12Make `is_intrinsic` query return the intrinsic nameOli Scherer-2/+1
2024-02-10Remove unnecessary `min_specialization` after bootstrapZalathar-1/+1
These crates all needed specialization for `newtype_index!`, which will no longer be necessary when the current nightly eventually becomes the next bootstrap compiler.
2024-02-09Auto merge of #120843 - matthiaskrgr:rollup-med37z5, r=matthiaskrgrbors-2/+0
Rollup of 8 pull requests Successful merges: - #113671 (Make privacy visitor use types more (instead of HIR)) - #120308 (core/time: avoid divisions in Duration::new) - #120693 (Invert diagnostic lints.) - #120704 (A drive-by rewrite of `give_region_a_name()`) - #120809 (Use `transmute_unchecked` in `NonZero::new`.) - #120817 (Fix more `ty::Error` ICEs in MIR passes) - #120828 (Fix `ErrorGuaranteed` unsoundness with stash/steal.) - #120831 (Startup objects disappearing from sysroot) r? `@ghost` `@rustbot` modify labels: rollup
2024-02-09Rollup merge of #120693 - nnethercote:invert-diagnostic-lints, r=davidtwcoMatthias Krüger-2/+0
Invert diagnostic lints. That is, change `diagnostic_outside_of_impl` and `untranslatable_diagnostic` from `allow` to `deny`, because more than half of the compiler has been converted to use translated diagnostics. This commit removes more `deny` attributes than it adds `allow` attributes, which proves that this change is warranted. r? ````@davidtwco````
2024-02-08Bail out of drop elaboration when encountering error typesOli Scherer-1/+4
2024-02-08Add a new debug_assertions instrinsic (compiler)Ben Kimock-1/+4
And in clippy
2024-02-06More comments, final tweaksMichael Goulet-0/+3
2024-02-06Teach typeck/borrowck/solvers how to deal with async closuresMichael Goulet-0/+3
2024-02-06Add CoroutineClosure to TyKind, AggregateKind, UpvarArgsMichael Goulet-2/+9