about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/mir
AgeCommit message (Collapse)AuthorLines
2022-04-30Auto merge of #96500 - SparrowLii:rpo, r=tmiaskobors-4/+94
Reduce duplication of RPO calculation of mir Computing the RPO of mir is not a low-cost thing, but it is duplicate in many places. In particular the `iterate_to_fixpoint` method which is called multiple times when computing the data flow. This PR reduces the number of times the RPO is recalculated as much as possible, which should save some compile time.
2022-04-30Eliminate duplication of RPO calculation for mirSparrowLii-4/+94
add `postorder_cache` to mir Body add `ReversePostorderCache` struct correct struct name and comments
2022-04-29remove and blessouz-a-4/+0
2022-04-29exp-stuff-dirtyouz-a-0/+15
2022-04-28Auto merge of #95976 - b-naber:valtree-constval-conversion, r=oli-obkbors-0/+1
Implement Valtree to ConstValue conversion Once we start to use `ValTree`s in the type system we will need to be able to convert them into `ConstValue` instances, which we want to continue to use after MIR construction. r? `@oli-obk` cc `@RalfJung`
2022-04-26Auto merge of #96425 - oli-obk:fix_incremental_regression_unsafety_checking, ↵bors-49/+19
r=compiler-errors Fix incremental perf regression unsafety checking Perf regression introduced in #96294 We will simply avoid emitting the name of the unsafe function in MIR unsafeck, since we're moving to THIR unsafeck anyway.
2022-04-26Revert "add `DefId` to unsafety violations and display function path in E0133"Oli Scherer-49/+19
This reverts commit 8b8f6653cfd54525714f02efe7af0a0f830e185c.
2022-04-26Rollup merge of #96400 - JakobDegen:shallow-init-docs, r=Dylan-DPCGuillaume Gomez-2/+0
Correct documentation for `Rvalue::ShallowInitBox` As a part of the big MIR docs PR, I had added a comment indicating that `Rvalue::ShallowInitBox` is disallowed after drop elaboration, but this is not true (no idea why I thought it was). Codegen has support for it, and trying to enforce this rule in the validator causes compiling core to ICE on the very first `box` statement. That being said, this `Rvalue` probably *should* be banned after drop elaboration - it doesn't seem like it's still useful for much. However, I do not have time right now to actually go investigate how difficult a change that is to make, so in the meantime fixing the docs to reflect the current situation seems like the right step. r? rust-lang/mir-opt
2022-04-25Auto merge of #96294 - Emilgardis:def_id-in-unsafetyviolationdetails, r=oli-obkbors-19/+49
Display function path in unsafety violations - E0133 adds `DefId` to `UnsafetyViolationDetails` this enables consumers to access the function definition that was reported to be unsafe and also changes the output for some E0133 diagnostics
2022-04-25Auto merge of #96116 - ouz-a:mir-opt, r=oli-obkbors-0/+20
Make derefer work everwhere Follow up work on previous PR's #95649 and #95857. r? rust-lang/mir-opt _Co-Authored-By: `@oli-obk_`
2022-04-25Correct documentation for `ShallowInitBox`Jakob Degen-2/+0
2022-04-24only show a simple description in E0133 span labelEmil Gardström-11/+32
2022-04-24add `DefId` to unsafety violations and display function path in E0133Emil Gardström-19/+28
this enables consumers to access the function definition that was reported to be unsafe
2022-04-22Relax restrictions for copy operandsJakob Degen-2/+6
2022-04-21deduplicate a lot of codeb-naber-5/+1
2022-04-21implement valtree -> constvalue conversionb-naber-1/+6
2022-04-20Rollup merge of #96160 - RalfJung:interpret-debug, r=oli-obkDylan DPC-0/+8
Miri/interpreter debugging tweaks Some changes I made to make debugging Miri with trace logging less terrible. r? ``@oli-obk``
2022-04-19Rollup merge of #96165 - RalfJung:miri-provenance-cleanup, r=oli-obkDylan DPC-0/+17
Miri provenance cleanup Reviewing https://github.com/rust-lang/rust/pull/95826 by ``@carbotaniuman`` made me realize that we could clean things up a little here. ``@carbotaniuman`` please let me know if you're okay with landing this (it will create a lot of conflicts with your PR), or if you'd prefer incorporating the ideas from this PR into yours. I think we want to end up in a situation where the function you called `ptr_reify_alloc` returns just two things, a concrete tag and an offset. Getting an `AllocId` from a concrete tag should be infallible like now. However a concrete tag and `Tag` don't have to be the same type. r? ``@oli-obk``
2022-04-19Rollup merge of #96162 - RalfJung:mark-uninit, r=oli-obkDylan DPC-8/+28
interpret: Fix writing uninit to an allocation When calling `mark_init`, we need to also be mindful of what happens with the relocations! Specifically, when we de-init memory, we need to clear relocations in that range as well or else strange things will happen (and printing will not show the de-init, since relocations take precedence there). Fixes https://github.com/rust-lang/miri/issues/2068. Here's the Miri testcase that this fixes (requires `-Zmiri-disable-validation`): ```rust use std::mem::MaybeUninit; fn main() { unsafe { let mut x = MaybeUninit::<i64>::uninit(); // Put in a ptr. x.as_mut_ptr().cast::<&i32>().write_unaligned(&0); // Overwrite parts of that pointer with 'uninit' through a Scalar. let ptr = x.as_mut_ptr().cast::<i32>(); *ptr = MaybeUninit::uninit().assume_init(); // Reading this back should hence work fine. let _c = *ptr; } } ``` Previously this failed with ``` error: unsupported operation: unable to turn pointer into raw bytes --> ../miri/uninit.rs:11:14 | 11 | let _c = *ptr; | ^^^^ unable to turn pointer into raw bytes | = help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support = note: inside `main` at ../miri/uninit.rs:11:14 ```
2022-04-18replace iter with into_iter()ouz-a-2/+2
2022-04-18avoid an unnecessary call to Pointer::into_parts, and caution against ↵Ralf Jung-0/+4
into_pointer_or_addr
2022-04-18add method to get absolute address of a pointer (useful only for Miri)Ralf Jung-0/+10
2022-04-18avoid pairing up AllocId and PointerTag, which is redundantRalf Jung-0/+3
2022-04-17check Allocation invariant during printingRalf Jung-0/+1
2022-04-17explain why prepare_relocation_copy works the way it doesRalf Jung-4/+11
2022-04-17add caution to some commentsRalf Jung-1/+7
2022-04-17when writing uninit to an allocation, also clear relocations like other ↵Ralf Jung-3/+9
writes do
2022-04-17add log warnings for when we overwrite parts of a pointer, and de-init the restRalf Jung-0/+8
2022-04-17fat vecouz-a-7/+5
2022-04-17format errouz-a-5/+3
2022-04-17little changesouz-a-7/+5
2022-04-17Stop using CRATE_DEF_INDEX.Camille GILLOT-2/+2
`CRATE_DEF_ID` and `CrateNum::as_def_id` are almost always what we want.
2022-04-16Make derefer work everwhereouz-a-0/+26
Co-Authored-By: Oli Scherer <332036+oli-obk@users.noreply.github.com>
2022-04-16Rollup merge of #96004 - JakobDegen:fix-validator-ice, r=petrochenkovDylan DPC-1/+2
Consider lifetimes when comparing types for equality in MIR validator Closes #95978 .
2022-04-13Auto merge of #95656 - cjgillot:no-id-hashing-mode, r=Aaron1011bors-22/+2
Remove NodeIdHashingMode. r? `@ghost`
2022-04-13Consider lifetimes when comparing types for equality in MIR validatorJakob Degen-1/+2
2022-04-13Auto merge of #94255 - b-naber:use-mir-constant-in-thir, r=oli-obkbors-9/+162
Use mir constant in thir instead of ty::Const This is blocked on https://github.com/rust-lang/rust/pull/94059 (does include its changes, the first two commits in this PR correspond to those changes) and https://github.com/rust-lang/rust/pull/93800 being reinstated (which had to be reverted). Mainly opening since `@lcnr` offered to give some feedback and maybe also for a perf-run (if necessary). This currently contains a lot of duplication since some of the logic of `ty::Const` had to be copied to `mir::ConstantKind`, but with the introduction of valtrees a lot of that functionality will disappear from `ty::Const`. Only the last commit contains changes that need to be reviewed here. Did leave some `FIXME` comments regarding future implementation decisions and some things that might be incorrectly implemented. r? `@oli-obk`
2022-04-12Remove NodeIdHashingMode.Camille GILLOT-22/+2
2022-04-11Remove rule that place loads may not happen with variant index setJakob Degen-5/+4
2022-04-11Add more clarifications in response to Ralf's commentsJakob Degen-102/+84
2022-04-11Address various comments and change some details around place to value ↵Jakob Degen-35/+36
conversions
2022-04-11Improve MIR phases documentation with summaries of changesJakob Degen-1/+23
2022-04-11Improve documentation for MIR terminatorsJakob Degen-27/+121
2022-04-11Improve documentation for MIR statement kinds.Jakob Degen-16/+76
2022-04-11Add documentation for the semantics of MIR rvaluesJakob Degen-23/+100
2022-04-11Adjust computation of place types to detect more invalid placesJakob Degen-0/+3
2022-04-11Improve documentation of `Place` and `Operand`Jakob Degen-13/+121
2022-04-11Add new `MutatatingUseContext`s for deinit and `SetDiscriminant`Jakob Degen-2/+6
2022-04-11Document semantics of `Deinit` and `SetDiscriminant` MIR statementsJakob Degen-0/+7
2022-04-11Add new `Deinit` statement kindJakob Degen-0/+11