about summary refs log tree commit diff
path: root/src/librustc_mir/transform
AgeCommit message (Collapse)AuthorLines
2018-11-10Auto merge of #55650 - nikic:funnel-shift, r=nagisabors-0/+2
Implement rotate using funnel shift on LLVM >= 7 Implement the rotate_left and rotate_right operations using llvm.fshl and llvm.fshr if they are available (LLVM >= 7). Originally I wanted to expose the funnel_shift_left and funnel_shift_right intrinsics and implement rotate_left and rotate_right on top of them. However, emulation of funnel shifts requires emitting a conditional to check for zero shift amount, which is not necessary for rotates. I was uncomfortable doing that here, as I don't want to rely on LLVM to optimize away that conditional (and for variable rotates, I'm not sure it can). We should revisit that question when we raise our minimum version requirement to LLVM 7 and don't need emulation code anymore. Fixes #52457.
2018-11-09Don't inline virtual calls (take 2)Wesley Wiser-45/+49
When I fixed the previous mis-optimizations, I didn't realize there were actually two different places where we mutate `callsites` and both of them should have the same behavior. As a result, if a function was inlined and that function contained virtual function calls, they were incorrectly being inlined. I also added a test case which covers this.
2018-11-08Rollup merge of #55761 - ljedrz:fix_promote_candidate_hack, r=estebankMark Rousskov-10/+5
mir: remove a hacky recursive helper function It can be replaced with a `while let` loop.
2018-11-08Rollup merge of #55739 - wesleywiser:mir_inline_fuel, r=nikomatsakisMark Rousskov-1/+13
Consume optimization fuel from the MIR inliner This makes it easier to debug mis-optimizations that occur during inlining. Thanks to @nikomatsakis for the suggestion!
2018-11-08Prevent ICE in const-prop array oob checkOliver Scherer-8/+8
2018-11-08Use `SmallVec` outparams in several functions.Nicholas Nethercote-1/+6
This avoids some allocations, reducing instruction counts by 1% on a couple of benchmarks.
2018-11-07mir: remove a hacky recursive helper functionljedrz-10/+5
2018-11-07drop glue works with raw ptrs, it must EscapeToRawRalf Jung-0/+7
2018-11-07array index accesses are stable placesRalf Jung-6/+8
2018-11-07no more action on ref or cast, but add new MIR statement for escaping a ptr ↵Ralf Jung-32/+69
to raw
2018-11-07Rollup merge of #55734 - teresy:shorthand-fields, r=davidtwcokennytm-3/+3
refactor: use shorthand fields refactor: use shorthand for single fields everywhere (excluding tests).
2018-11-07Consume optimization fuel from the MIR inlinerWesley Wiser-1/+13
This makes it easier to debug mis-optimizations that occur during inlining. Thanks to @nikomatsakis for the suggestion!
2018-11-06refactor: use shorthand fieldsteresy-3/+3
2018-11-05miri: binary_op_val -> binary_op_immRalf Jung-1/+1
2018-11-04rustc_target: pass contexts by reference, not value.Eduard-Mihai Burtescu-4/+4
2018-11-04Auto merge of #55393 - oli-obk:immediate_immediately, r=RalfJungbors-10/+10
Rename `Value` to `Immediate` for miri r? @RalfJung
2018-11-03Implement rotate using funnel shift on LLVM >= 7Nikita Popov-0/+2
Implement the rotate_left and rotate_right operations using llvm.fshl and llvm.fshr if they are available (LLVM >= 7). Originally I wanted to expose the funnel_shift_left and funnel_shift_right intrinsics and implement rotate_left and rotate_right on top of them. However, emulation of funnel shifts requires emitting a conditional to check for zero shift amount, which is not necessary for rotates. I was uncomfortable doing that here, as I don't want to rely on LLVM to optimize away that conditional (and for variable rotates, I'm not sure it can). We should revisit that question when we raise our minimum version requirement to LLVM 7 and don't need emulation code anymore.
2018-11-03Rename `Binder::no_late_bound_regions` to `Binder::no_bound_vars`scalexm-1/+1
2018-11-02Rename `Value` to `Immediate` for miriOliver Scherer-10/+10
2018-10-29fix nitsRalf Jung-2/+7
2018-10-29make inliner remove the fn_entry flag on Retag statementsRalf Jung-0/+8
2018-10-29Emit Retag statements, kill Validate statementsRalf Jung-421/+184
Also "rename" -Zmir-emit-validate to -Zmir-emit-retag, which is just a boolean (yes or no).
2018-10-28Auto merge of #54487 - RalfJung:ctfe-backtrace, r=oli-obkbors-17/+8
Delayed CTFE backtraces This renames the env var that controls CTFE backtraces from `MIRI_BACKTRACE` to `RUST_CTFE_BACKTRACE` so that we can use `MIRI_BACKTRACE` in the miri tool to only show backtraces of the main miri execution. It also makes `RUST_CTFE_BACKTRACE` only show backtraces that actually get rendered as errors, instead of showing them eagerly when the `Err` happens. The current behavior is near useless in miri because it shows about one gazillion backtraces for errors that we later catch and do not care about. However, @oli-obk likes the current behavior for rustc CTFE work so it is still available via `RUST_CTFE_BACKTRACE=immediate`. NOTE: This is based on top of https://github.com/rust-lang/rust/pull/53821. Only [the last three commits](https://github.com/oli-obk/rust/compare/sanity_query...RalfJung:ctfe-backtrace) are new. Fixes https://github.com/rust-lang/rust/issues/53355
2018-10-28Rollup merge of #55412 - oli-obk:min_const_fn_ice, r=estebankkennytm-2/+3
Fix an ICE in the min_const_fn analysis fixes https://github.com/rust-lang/rust/issues/55395 cc @Centril
2018-10-28remove some unused CTFE error variantsRalf Jung-4/+0
2018-10-28rename env var to control ctfe backtraces, and make it usually show the ↵Ralf Jung-13/+8
backtrace delayed The env var is now RUST_CTFE_BACKTRACE. Similar to RUST_BACKTRACE, it usually only prints a backtrace when the error actually surfaces, not when it happens. This makes a difference when we catch errors. As per @oli-obk's request, one can set RUST_CTFE_BACKTRACE=immediate to get the backtrace shown immediately.
2018-10-28Rollup merge of #55244 - wesleywiser:issue-50411, r=nikomatsakiskennytm-57/+73
Don't rerun MIR passes when inlining Fixes #50411 r? @nikomatsakis I updated your commit message with additional details. Let me know if any of that is incorrect. I also added the appropriate `compile-flags` directive to the test. Thanks for you help on this! cc @RalfJung related to your PR #55086
2018-10-27Fix an ICE in the min_const_fn analysisOliver Scherer-2/+3
2018-10-27Refactor and add `PlaceContext::AscribeUserTy`.David Wood-35/+48
This commit refactors `PlaceContext` to split it into four different smaller enums based on if the context represents a mutating use, non-mutating use, maybe-mutating use or a non-use (this is based on the recommendation from @oli-obk on Zulip[1]). This commit then introduces a `PlaceContext::AscribeUserTy` variant. `StatementKind::AscribeUserTy` is now correctly mapped to `PlaceContext::AscribeUserTy` instead of `PlaceContext::Validate`. `PlaceContext::AscribeUserTy` can also now be correctly categorized as a non-use which fixes an issue with constant promotion in statics after a cast introduces a `AscribeUserTy` statement. [1]: https://rust-lang.zulipchat.com/#narrow/stream/122657-wg-nll/subject/.2355288.20cast.20fails.20to.20promote.20to.20'static/near/136536949
2018-10-27Add helpful logging statements.David Wood-1/+29
This commit adds logging statements to `promote_consts` and `qualify_consts` to make it easier to understand what it is doing.
2018-10-26Checkpoint: Added abstraction over collection of projections into user type.Felix S. Klock II-3/+3
I did not think I would need this in the MIR, but in general local decls are going to need to support this. (That, or we need to be able define a least-upper-bound for a collection of types encountered via the pattern compilation.)
2018-10-26Auto merge of #55382 - kennytm:rollup, r=kennytmbors-3/+30
Rollup of 21 pull requests Successful merges: - #54816 (Don't try to promote already promoted out temporaries) - #54824 (Cleanup rustdoc tests with `@!has` and `@!matches`) - #54921 (Add line numbers option to rustdoc) - #55167 (Add a "cheap" mode for `compute_missing_ctors`.) - #55258 (Fix Rustdoc ICE when checking blanket impls) - #55264 (Compile the libstd we distribute with -Ccodegen-unit=1) - #55271 (Unimplement ExactSizeIterator for MIR traversing iterators) - #55292 (Macro diagnostics tweaks) - #55298 (Point at macro definition when no rules expect token) - #55301 (List allowed tokens after macro fragments) - #55302 (Extend the impl_stable_hash_for! macro for miri.) - #55325 (Fix link to macros chapter) - #55343 (rustbuild: fix remap-debuginfo when building a release) - #55346 (Shrink `Statement`.) - #55358 (Remove redundant clone (2)) - #55370 (Update mailmap for estebank) - #55375 (Typo fixes in configure_cmake comments) - #55378 (rustbuild: use configured linker to build boostrap) - #55379 (validity: assert that unions are non-empty) - #55383 (Use `SmallVec` for the queue in `coerce_unsized`.) - #55391 (bootstrap: clean up a few clippy findings)
2018-10-26Rollup merge of #54816 - oli-obk:double_promotion, r=alexregkennytm-3/+30
Don't try to promote already promoted out temporaries fixes #53201 r? @eddyb
2018-10-25Clear up nonpromotable const fn call qualificationOliver Scherer-5/+6
2018-10-25Grammar nitOliver Scherer-2/+2
2018-10-25Clarify exclusion comment furtherOliver Scherer-1/+2
2018-10-25Explain why we can encounter a `Goto` terminator that we want to promoteOliver Scherer-1/+7
2018-10-25Explain a comment in more detailOliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer-2/+9
2018-10-25Don't extend `hir::Def` when there's already a dedicated "function-like" ↵Oliver Schneider-11/+16
detector
2018-10-25Report const eval error inside the queryOliver Schneider-20/+19
2018-10-25Fix CR feedbackWesley Wiser-1/+2
2018-10-22Replace the `run_passes!` macro with a regular functionWesley Wiser-67/+67
As suggested in the feedback for #55244. When I replaced the macro with a function, rustc started complaining that there were two unused functions so I also removed those.
2018-10-22Remove the `suite_index` parameter of the `run_passes!()` macroWesley Wiser-6/+6
This can be obtained via the `$mir_phase` value.
2018-10-22Don't rerun Mir passes when inliningNiko Matsakis-5/+20
When inlining a function using the Mir inliner, we shouldn't rerun the various Mir passes on it because the Mir has already been lowered and that wil break various early Mir passes. The issue in #50411 is that we've inlined a function with promotions whose Mir has already been lowered. The promotions are then copied into the local function and we begin to run passes on their lowered Mir which causes the ICE. Fixes #50411
2018-10-20Auto merge of #55014 - ljedrz:lazyboye_unwraps, r=matthewjasperbors-1/+1
Prefer unwrap_or_else to unwrap_or in case of function calls/allocations The contents of `unwrap_or` are evaluated eagerly, so it's not a good pick in case of function calls and allocations. This PR also changes a few `unwrap_or`s with `unwrap_or_default`. An added bonus is that in some cases this change also reveals if the object it's called on is an `Option` or a `Result` (based on whether the closure takes an argument).
2018-10-19Prefer `Default::default` over `FxHash*::default` in struct constructorsOliver Scherer-8/+6
2018-10-19Deprecate the `FxHashMap()` and `FxHashSet()` constructor function hackOliver Scherer-5/+5
2018-10-19Rollup merge of #55071 - oli-obk:const_cast_🍨, r=RalfJungkennytm-3/+16
Fix ICE and report a human readable error fixes #55063 r? @RalfJung
2018-10-19Prefer unwrap_or_else to unwrap_or in case of function calls/allocationsljedrz-1/+1
2018-10-17Squash closure cast error into fn ptr cast errorOliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer-4/+1