about summary refs log tree commit diff
path: root/src/test/mir-opt
AgeCommit message (Collapse)AuthorLines
2020-09-02inliner: Avoid query cycles when optimizing generatorsTomasz Miąsko-0/+18
The HIR Id trick is insufficient to prevent query cycles when optimizing generators, since merely requesting a layout of a generator also computes its `optimized_mir`. Make no attempts to inline functions into generators within the same crate to avoid query cycles.
2020-08-31Add new `-Z dump-mir-spanview` optionRich Kadel-0/+215
Similar to `-Z dump-mir-graphviz`, this adds the option to write HTML+CSS files that allow users to analyze the spans associated with MIR elements (by individual statement, just terminator, or overall basic block). This PR was split out from PR #76004, and exposes an API for spanview HTML+CSS files that is also used to analyze code regions chosen for coverage instrumentation (in a follow-on PR). Rust compiler MCP rust-lang/compiler-team#278 Relevant issue: #34701 - Implement support for LLVMs code coverage instrumentation
2020-08-29New pass to optimize `if`conditions on integrals to switches on the integerSimon Vandel Sillesen-0/+411
Fixes #75144
2020-08-21Suppress "const" prefix of FnDef in MIR dumpLzu Tao-115/+115
2020-08-20Auto merge of #75747 - cuviper:rollup-icke90l, r=cuviperbors-3/+0
Rollup of 8 pull requests Successful merges: - #75672 (Move to intra-doc links for task.rs and vec.rs) - #75702 (Clean up E0759 explanation) - #75703 (Enable stack-overflow detection on musl for non-main threads) - #75710 (Fix bad printing of const-eval queries) - #75716 (Upgrade Emscripten on CI to 1.39.20 ) - #75731 (Suppress ty::Float in MIR comments of ty::Const) - #75733 (Remove duplicated alloc vec bench push_all_move) - #75743 (Rename rustc_lexer::TokenKind::Not to Bang) Failed merges: r? @ghost
2020-08-20Suppress ty::Float in MIR comments of ty::ConstLzu Tao-3/+0
Already covered by MIR constant comments
2020-08-20Auto merge of #75562 - oli-obk:const_prop_no_aggregates, r=wesleywiserbors-10/+59
Check that we don't use `Rvalue::Aggregate` after the deaggregator fixes #75481 r? @wesleywiser cc @RalfJung (modified the validator)
2020-08-20Suppress MIR comments of Unit typeLzu Tao-985/+39
2020-08-20Suppress MIR comments for FnDef in ty::ConstLzu Tao-336/+11
2020-08-19Auto merge of #75563 - richkadel:llvm-coverage-map-gen-5.4, r=wesleywiserbors-46/+5
Moved coverage counter injection from BasicBlock to Statement. As discussed on Zulip: https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Implement.20LLVM-compatible.20source-based.20cod.20compiler-team.23278
2020-08-18Moved coverage counter injection from BasicBlock to Statement.Rich Kadel-46/+5
2020-08-18mir building: fix some commentsRalf Jung-5/+5
2020-08-18Validate the MIR of all optimizations in the mir-opt directoryOliver Scherer-10/+59
2020-08-17Update MIR tests with comment verbosity fixAustin Lasher-3679/+30
2020-08-16Implement 'considered equal' for statements, so that for example `_0 = _1` ↵Simon Vandel Sillesen-231/+158
and `discriminant(_0) = discriminant(0)` are considered equal if 0 is a fieldless variant of an enum
2020-08-15MatchBranchSimplification: fix equal const bool assignmentsTomasz Miąsko-24/+365
The match branch simplification is applied when target blocks contain statements that are either equal or perform a const bool assignment with different values to the same place. Previously, when constructing new statements, only statements from a single block had been examined. This lead to a misoptimization when statements are equal because the assign the *same* const bool value to the same place. Fix the issue by examining statements from both blocks when deciding on replacement.
2020-08-14MatchBranchSimplification: copy discriminant instead of moving itTomasz Miąsko-2/+2
It might be necessary to use its value more than once.
2020-08-14Add fixkadmin-1/+172
This also explicitly checks that the types are `bool`. `try_eval_bool` also appears to just succeed for `u8`, so this ensures that it actually is a bool before casting.
2020-08-13Add regression test for matching on u8kadmin-0/+21
2020-08-13Add 64bit / 32bit fileskadmin-22/+91
2020-08-13bless diffkadmin-0/+64
Just output the current bless'd MIR diff The tests are still fairly broken rn
2020-08-13Update to actually use transformkadmin-2/+1
2020-08-13First iteration of simplify match brancheskadmin-0/+13
2020-08-11move Deaggregate pass to post_borrowck_cleanupRalf Jung-343/+762
2020-08-09bless MIRRalf Jung-31/+31
2020-08-07Auto merge of #74821 - oli-obk:const_eval_read_uninit_fast_path, r=wesleywiserbors-4/+179
Check whether locals are too large instead of whether accesses into them are too large Essentially this stops const prop from attempting to optimize ```rust let mut x = [0_u8; 5000]; x[42] = 3; ``` I don't expect this to be a perf improvement without #73656 (which is also where the lack of this PR will be a perf regression). r? @wesleywiser
2020-08-07Rollup merge of #74888 - infinity0:ignore-endian-big, r=nikomatsakisYuki Okushi-5/+5
compiletest: ignore-endian-big, fixes #74829, fixes #74885 See discussion on #74829 I tested it on a Debian s390x machine, works well.
2020-08-04Completes support for coverage in external cratesRich Kadel-57/+109
The prior PR corrected for errors encountered when trying to generate the coverage map on source code inlined from external crates (including macros and generics) by avoiding adding external DefIds to the coverage map. This made it possible to generate a coverage report including external crates, but the external crate coverage was incomplete (did not include coverage for the DefIds that were eliminated. The root issue was that the coverage map was converting Span locations to source file and locations, using the SourceMap for the current crate, and this would not work for spans from external crates (compliled with a different SourceMap). The solution was to convert the Spans to filename and location during MIR generation instead, so precompiled external crates would already have the correct source code locations embedded in their MIR, when imported into another crate.
2020-07-31compiletest: ignore-endian-big, fixes #74829, fixes #74885Ximin Luo-5/+5
2020-07-29Update tests after rebaseOliver Scherer-1/+1
2020-07-29Add test ensuring that we don't propagate large arraysOliver Scherer-0/+177
2020-07-29Stop propagating to locals that were marks as unpropagatable.Oliver Scherer-4/+2
We used to erase these values immediately after propagation, but some things slipped through and it caused us to still initialize huge locals.
2020-07-29Move mir-opt tests to toplevelXavier Denis-235/+10
2020-07-29add crate name to mir dumpsXavier Denis-156/+156
2020-07-27mv std libs to library/mark-856/+856
2020-07-24Auto merge of #74507 - lcnr:const-prop-into-op, r=oli-obkbors-27/+211
add `visit_operand` to const prop r? @oli-obk
2020-07-24Rollup merge of #74715 - oli-obk:mir_pass_diff, r=wesleywiserManish Goregaokar-483/+314
Add a system for creating diffs across multiple mir optimizations. r? @wesleywiser
2020-07-24Add a system for creating diffs across multiple mir optimizations.Oliver Scherer-483/+314
2020-07-22Optimize away BitAnd and BitOr when possibleXavier Denis-0/+98
2020-07-22const prop into operandsBastian Kauschke-27/+211
2020-07-19Auto merge of #74091 - richkadel:llvm-coverage-map-gen-4, r=tmandrybors-22/+34
Generating the coverage map @tmandry @wesleywiser rustc now generates the coverage map and can support (limited) coverage report generation, at the function level. Example commands to generate a coverage report: ```shell $ BUILD=$HOME/rust/build/x86_64-unknown-linux-gnu $ $BUILD/stage1/bin/rustc -Zinstrument-coverage \ $HOME/rust/src/test/run-make-fulldeps/instrument-coverage/main.rs $ LLVM_PROFILE_FILE="main.profraw" ./main called $ $BUILD/llvm/bin/llvm-profdata merge -sparse main.profraw -o main.profdata $ $BUILD/llvm/bin/llvm-cov show --instr-profile=main.profdata main ``` ![rust coverage report only 20200706](https://user-images.githubusercontent.com/3827298/86697299-1cbe8f80-bfc3-11ea-8955-451b48626991.png) r? @wesleywiser Rust compiler MCP rust-lang/compiler-team#278 Relevant issue: #34701 - Implement support for LLVMs code coverage instrumentation
2020-07-17Rollup merge of #74411 - jonas-schievink:unbreak-mir, r=matthewjasperManish Goregaokar-7/+0
Don't assign `()` to `!` MIR locals Implements the fix described in https://github.com/rust-lang/rust/issues/73860#issuecomment-651731893. Fixes https://github.com/rust-lang/rust/issues/73860 r? @matthewjasper
2020-07-17Generating the coverage mapRich Kadel-22/+34
rustc now generates the coverage map and can support (limited) coverage report generation, at the function level. Example: $ BUILD=$HOME/rust/build/x86_64-unknown-linux-gnu $ $BUILD/stage1/bin/rustc -Zinstrument-coverage \ $HOME/rust/src/test/run-make-fulldeps/instrument-coverage/main.rs $ LLVM_PROFILE_FILE="main.profraw" ./main called $ $BUILD/llvm/bin/llvm-profdata merge -sparse main.profraw -o main.profdata $ $BUILD/llvm/bin/llvm-cov show --instr-profile=main.profdata main 1| 1|pub fn will_be_called() { 2| 1| println!("called"); 3| 1|} 4| | 5| 0|pub fn will_not_be_called() { 6| 0| println!("should not have been called"); 7| 0|} 8| | 9| 1|fn main() { 10| 1| let less = 1; 11| 1| let more = 100; 12| 1| 13| 1| if less < more { 14| 1| will_be_called(); 15| 1| } else { 16| 1| will_not_be_called(); 17| 1| } 18| 1|}
2020-07-17Make fmt::Arguments::as_str() return a 'static str.Mara Bos-264/+252
2020-07-16Don't assign `()` to `!` MIR localsJonas Schievink-7/+0
2020-07-15improve namingBastian Kauschke-48/+48
2020-07-15mir opt cross compileBastian Kauschke-12/+12
2020-07-15mir opt diffBastian Kauschke-36/+36
2020-07-08Correctly mark the ending span of a match armAyaz Hafiz-86/+86
Closes #74050 r? @matthewjasper
2020-07-05Auto merge of #73879 - ecstatic-morse:discr-switch-uninit, r=oli-obkbors-16/+44
Handle inactive enum variants in `MaybeUninitializedPlaces` Resolves the first part of #69715. This is the equivalent of #68528 but for `MaybeUninitializedPlaces`. Because we now notify drop elaboration that inactive enum variants might be uninitialized, some drops get marked as ["open" that were previously "static"](https://github.com/rust-lang/rust/blob/e0e5d82e1677c82d209b214bbfc2cc5705c2336a/src/librustc_mir/transform/elaborate_drops.rs#L191). Unlike in #69715, this isn't strictly better: An "open" drop expands to more MIR than a simple call to the drop shim. However, because drop elaboration considers each field of an "open" drop separately, it can sometimes eliminate unnecessary drops of moved-from or unit-like enum variants. This is the case for `Option::unwrap`, which is reflected in the `mir-opt` test. cc @eddyb r? @oli-obk