about summary refs log tree commit diff
path: root/src/librustc/mir
AgeCommit message (Collapse)AuthorLines
2019-12-02Add predecessors fn to ReadOnlyBodyCache, fix more Body -> ↵Paul Daniel Faria-2/+6
(ReadOnly)BodyCache type errors
2019-12-02Add read_only fn to BodyCache<&mut...> impl, fix more Body -> ↵Paul Daniel Faria-0/+9
(ReadOnly)BodyCache type errors
2019-12-02Fix a large number of Body -> (ReadOnly)BodyCache type errors, add ↵Paul Daniel Faria-21/+43
predecessor_locations fn to ReadOnlyBodyCache
2019-12-02Account for new maybe_sideeffect helper that requires predecessorsPaul Daniel Faria-54/+128
2019-12-02Improved BodyCache body impl so it only returns a sharable ref, add new ↵Paul Daniel Faria-6/+16
body_mut method, fix visit macros, simplify usage in codegen_ssa analyzer
2019-12-02Simplify Cache wrapper to single type, impl Deref on it, fix all compilation ↵Paul Daniel Faria-52/+60
errors in librustc_codegen_ssa
2019-12-02Move predecessor cache outside of Body, use wrapper types to manage Cache ↵Paul Daniel Faria-150/+258
and Body (WIP, amend this commit)
2019-12-02Move predecessors cache back to its own typePaul Daniel Faria-12/+58
This ensures that the cache can be properly ignored during encoding and decoding. Fix panics that arose due to lack of encoding
2019-12-02Add back cache invalidation to basic_blocks_and_local_decls_mutPaul Daniel Faria-1/+3
2019-12-02Address excessive line length that was triggering warning during lintingPaul Daniel Faria-1/+5
2019-12-02Move predecessors cache invalidation back to basic_blocks_mut, add a couple ↵Paul Daniel Faria-55/+17
more ensure_predecessors to prevent panics
2019-12-02Ensure predecessors are recomputed at critical points, fixes panicsPaul Daniel Faria-17/+18
2019-12-02Address linting errors caught by CIPaul Daniel Faria-2/+4
2019-12-02Fix Mir visitor macro to ensure it calls the proper method to invalidate the ↵Paul Daniel Faria-12/+24
predecessors cache
2019-12-02Add pass to ensure predecessors cache is generated after optimizationPaul Daniel Faria-15/+3
2019-12-02Stop invalidating predecessors cache when accessing unique basic block, ↵Paul Daniel Faria-8/+41
invalidate cache when accessing unique terminator
2019-12-02Get rid of old commentPaul Daniel Faria-1/+0
2019-12-02Inline cache impl into Body, rename predecessor fns, change output of ↵Paul Daniel Faria-89/+36
predecessors_for to slice
2019-12-02Remove interior mutability in mir predecessors cachePaul Daniel Faria-16/+25
2019-12-02miri: add throw_machine_stop macroRalf Jung-0/+7
2019-12-02Add From instances for Pointer -> ScalarMaybeUndef and Pointer -> ImmediateRalf Jung-0/+7
2019-12-02Rollup merge of #66926 - RalfJung:miri-stop, r=oli-obkMazdak Farrokhzad-16/+12
add reusable MachineStop variant to Miri engine error enum Replace the Miri-tool-specific `Exit` error variant with something dynamically typed that all clients of the Miri engine can use. r? @oli-obk Cc https://github.com/rust-lang/rust/issues/66902
2019-12-02Rollup merge of #66850 - eddyb:span-free-formats, r=oli-obkMazdak Farrokhzad-2/+6
rustc: hide HirId's fmt::Debug output from -Z span_free_formats. This replaces the only occurrences of `HirId {...}` from tests with paths, i.e.: ```rust [closure@HirId { owner: DefIndex(4), local_id: 15 } q:&i32, t:&T] ``` becomes, after this PR: ```rust [closure@foo<T>::{{closure}}#0 q:&i32, t:&T] ``` r? @oli-obk cc @michaelwoerister
2019-12-02Rollup merge of #66789 - eddyb:mir-source-scope-local-data, r=oli-obkMazdak Farrokhzad-6/+12
rustc: move mir::SourceScopeLocalData to a field of SourceScopeData. By having one `ClearCrossCrate<SourceScopeLocalData>` for each scope, as opposed to a single `ClearCrossCrate` for all the `SourceScopeLocalData`s, we can represent the fact that some scopes have `SourceScopeLocalData` associated with them, and some don't. This is useful when doing MIR inlining across crates, because the `ClearCrossCrate` will be `Clear` for the cross-crate MIR scopes and `Set` for the local ones. Also see https://github.com/rust-lang/rust/pull/66203#issuecomment-555589574 for some context around this approach. Fixes #51314.
2019-12-01Miri core engine: use throw_ub instead of throw_panicRalf Jung-5/+21
2019-12-01add reusable MachineStop variant to Miri engine error enumRalf Jung-16/+12
2019-12-01Rollup merge of #66832 - RalfJung:const-prop-no-alloc, r=oli-obkMazdak Farrokhzad-7/+13
const_prop: detect and avoid catching Miri errors that require allocation r? @wesleywiser @oli-obk
2019-11-30rustc: move mir::SourceScopeLocalData to a field of SourceScopeData.Eduard-Mihai Burtescu-6/+5
2019-11-30rustc: move MIR source_scope_local_data's ClearCrossCrate to be around elements.Eduard-Mihai Burtescu-2/+9
2019-11-29Auto merge of #66321 - ninjasource:async-fn-resume-after-completion, r=oli-obkbors-9/+29
Async fn resume after completion #65419 -- Attempting to run an async fn after completion mentions generators Not yet ready for review - work in progress Just need to run the tests on a proper build server
2019-11-28rustc: hide HirId's fmt::Debug output from -Z span_free_formats.Eduard-Mihai Burtescu-2/+6
2019-11-28const_prop: detect and avoid catching Miri errors that require allocationRalf Jung-7/+13
2019-11-28Removed FIXME commentDavid Haig-2/+0
2019-11-28Remove duplication using single variant for errorDavid Haig-17/+14
2019-11-28Fixed merge issueDavid Haig-0/+10
2019-11-28Fixed merge issueDavid Haig-1/+1
2019-11-28SquashDavid Haig-4/+19
2019-11-28Auto merge of #66294 - davidhewitt:const_fn_memoization, r=oli-obkbors-1/+4
Add memoization for const function evaluations When a const function is being evaluated, as long as all its arguments are zero-sized-types (or it has no arguments) then we can trivially memoize the evaluation result using the existing query mechanism. With thanks to @oli-obk for mentoring me through this at RustFest Barcelona. r? @oli-obk
2019-11-27Rollup merge of #66798 - bwignall:typo, r=varkorTyler Mandry-2/+2
Fix spelling typos Should be non-semantic. Uses https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines to find likely typos.
2019-11-27rustc: move debug info from LocalDecl and UpvarDecl into a dedicated ↵Eduard-Mihai Burtescu-52/+52
VarDebugInfo.
2019-11-27Add memoization for const function evaluationsDavid Hewitt-1/+4
When a const function is being evaluated, as long as all its arguments are zero-sized-types (or it has no arguments) then we can trivially memoize the evaluation result using the existing query mechanism.
2019-11-27Auto merge of #66677 - wesleywiser:fix_const_prop_alloc_id_ice, r=oli-obkbors-1/+1
[const prop] Fix "alloc id without corresponding allocation" ICE r? @oli-obk
2019-11-26Fix spelling typosBrian Wignall-2/+2
2019-11-22Allow miri allocation interning to work im generic MachinesWesley Wiser-1/+1
This is necessary so that the `ComstPropMachine` can intern allocations.
2019-11-22Rollup merge of #66637 - RalfJung:typo, r=CentrilMazdak Farrokhzad-1/+1
fix reoccuring typo: dereferencable -> dereferenceable
2019-11-22Rollup merge of #66587 - matthewjasper:handle-static-as-const, r=oli-obkMazdak Farrokhzad-24/+83
Handle statics in MIR as const pointers This is the first PR towards the goal of removing `PlaceBase::Static`. In this PR: * Statics are lowered to dereferencing a const pointer. * The temporaries holding such pointers are tracked in MIR, for the most part this is only used for diagnostics. There are two exceptions: * The borrow checker has some checks for thread-locals that directly use this data. * Const checking will suppress "cannot dereference raw pointer" diagnostics for pointers to `static mut`/`extern static`. This is to maintain the current behaviour (12 tests fail otherwise). The following are left to future PRs (I think that @spastorino will be working on the first 3): * Applying the same treatments to promoted statics. * Removing `PlaceBase::Static`. * Replacing `PlaceBase` with `Local`. * Moving the ever growing collection of metadata that we have for diagnostics in MIR passes somewhere more appropriate. r? @oli-obk
2019-11-22fix reoccuring typo: dereferencable -> dereferenceableRalf Jung-1/+1
2019-11-22Auto merge of #66282 - Centril:simplify-try, r=oli-obkbors-7/+7
[mir-opt] asking `?`s in a more optimized fashion This PR works towards https://github.com/rust-lang/rust/issues/66234 by providing two optimization passes meant to run in sequence: - `SimplifyArmIdentity` which transforms something like: ```rust _LOCAL_TMP = ((_LOCAL_1 as Variant ).FIELD: TY ); ((_LOCAL_0 as Variant).FIELD: TY) = move _LOCAL_TMP; discriminant(_LOCAL_0) = VAR_IDX; ``` into: ```rust _LOCAL_0 = move _LOCAL_1 ``` - `SimplifyBranchSame` which transforms `SwitchInt`s to identical basic blocks into a `goto` to the first reachable target. Together, these are meant to simplify the following into just `res`: ```rust match res { Ok(x) => Ok(x), Err(x) => Err(x), } ``` It should be noted however that the desugaring of `?` includes a function call and so the first pass in this PR relies on inlining to substitute that function call for identity on `x`. Inlining requires `mir-opt-level=2` so this might not have any effect in perf-bot but let's find out. r? @oli-obk -- This is WIP, but I'd appreciate feedback. :)
2019-11-21Address review commentsMatthew Jasper-7/+4
2019-11-21Track pointers to statics in MIRMatthew Jasper-16/+60