summary refs log tree commit diff
path: root/compiler/rustc_middle/src/mir
AgeCommit message (Collapse)AuthorLines
2020-11-07fix `super_visit_with` for `Terminator`Bastian Kauschke-17/+14
2020-11-06Auto merge of #78267 - richkadel:llvm-coverage-counters-2.0.3r1, r=tmandrybors-25/+70
Working expression optimization, and some improvements to branch-level source coverage This replaces PR #78040 after reorganizing the original commits (by request) into a more logical sequence of major changes. Most of the work is in the MIR `transform/coverage/` directory (originally, `transform/instrument_coverage.rs`). Note this PR includes some significant additional debugging capabilities, to help myself and any future developer working on coverage improvements or issues. In particular, there's a new Graphviz (.dot file) output for the coverage graph (the `BasicCoverageBlock` control flow graph) that provides ways to get some very good insight into the relationships between the MIR, the coverage graph BCBs, coverage spans, and counters. (There are also some cool debugging options, available via environment variable, to alter how some data in the graph appears.) And the code for this Graphviz view is actually generic... it can be used by any implementation of the Rust `Graph` traits. Finally (for now), I also now output information from `llvm-cov` that shows the actual counters and spans it found in the coverage map, and their counts (from the `--debug` flag). I found this to be enormously helpful in debugging some coverage issues, so I kept it in the test results as well for additional context. `@tmandry` `@wesleywiser` r? `@tmandry` Here's an example of the new coverage graph: * Within each `BasicCoverageBlock` (BCB), you can see each `CoverageSpan` and its contributing statements (MIR `Statement`s and/or `Terminator`s) * Each `CoverageSpan` has a `Counter` or and `Expression`, and `Expression`s show their Add/Subtract operation with nested operations. (This can be changed to show the Counter and Expression IDs instead, or in addition to, the BCB.) * The terminators of all MIR `BasicBlock`s in the BCB, including one final `Terminator` * If an "edge counter" is required (because we need to count an edge between blocks, in some cases) the edge's Counter or Expression is shown next to its label. (Not shown in the example below.) (FYI, Edge Counters are converted into a new MIR `BasicBlock` with `Goto`) <img width="1116" alt="Screen Shot 2020-10-17 at 12 23 29 AM" src="https://user-images.githubusercontent.com/3827298/96331095-616cb480-100f-11eb-8212-60f2d433e2d8.png"> r? `@tmandry` FYI: `@wesleywiser`
2020-11-06Auto merge of #77856 - GuillaumeGomez:automatic-links-lint, r=jyn514,ollie27bors-4/+4
Add non_autolinks lint Part of #77501. r? `@jyn514`
2020-11-05Addressed all feedback to dateRich Kadel-14/+0
2020-11-05Rust coverage before splitting instrument_coverage.rsRich Kadel-25/+84
2020-11-05Fix even more URLsGuillaume Gomez-4/+4
2020-11-05Rollup merge of #78742 - vn-ki:fix-issue-78655, r=oli-obkMara Bos-3/+9
make intern_const_alloc_recursive return error fix #78655 r? ``@oli-obk``
2020-11-05Rollup merge of #78733 - matthiaskrgr:cl11ppy, r=jyn514Mara Bos-1/+1
fix a couple of clippy warnings: filter_next manual_strip redundant_static_lifetimes single_char_pattern unnecessary_cast unused_unit op_ref redundant_closure useless_conversion
2020-11-04make intern_const_alloc_recursive return error fix #78655Vishnunarayan K I-3/+9
2020-11-04`u128` truncation and sign extension are not just interpreter relatedoli-37/+4
2020-11-04fix a couple of clippy warnings:Matthias Krüger-1/+1
filter_next manual_strip redundant_static_lifetimes single_char_pattern unnecessary_cast unused_unit op_ref redundant_closure useless_conversion
2020-11-04Move ZST constant to the top of the impl blockoli-2/+2
2020-11-04Do not raise interp errors from the scalar int moduleoli-2/+8
2020-11-04Add helper for getting an `int` out of a `Scalar`oli-0/+8
2020-11-04Replace `Scalar::zst` with a `Scalar::ZST` constantoli-4/+1
2020-11-04No need for a `zst` constructor method when we can have a constantoli-1/+1
2020-11-04s/Scalar::Raw/Scalar::Intoli-23/+23
2020-11-04Split the "raw integer bytes" part out of `Scalar`Oliver Scherer-91/+25
2020-10-30Remove implicit `Continue` typeLeSeulArtichaut-12/+12
2020-10-30Use `ControlFlow::is{break,continue}`LeSeulArtichaut-1/+1
2020-10-30TypeVisitor: use `std::ops::ControlFlow` instead of `bool`LeSeulArtichaut-43/+64
2020-10-28Rollup merge of #78351 - RalfJung:validity-unsafe-cell, r=oli-obkDylan DPC-12/+0
Move "mutable thing in const" check from interning to validity This moves the check for mutable things (such as `UnsafeCell` or `&mut`) in a`const` from interning to validity. That means we can give more targeted error messages (pointing out *where* the problem lies), and we can simplify interning a bit. Also fix the interning mode used for promoteds in statics. r? @oli-obk
2020-10-26Auto merge of #68965 - eddyb:mir-inline-scope, r=nagisa,oli-obkbors-7/+49
rustc_mir: track inlined callees in SourceScopeData. We now record which MIR scopes are the roots of *other* (inlined) functions's scope trees, which allows us to generate the correct debuginfo in codegen, similar to what LLVM inlining generates. This PR makes the `ui` test `backtrace-debuginfo` pass, if the MIR inliner is turned on by default. Also, `#[track_caller]` is now correct in the face of MIR inlining (cc `@anp).` Fixes #76997. r? `@rust-lang/wg-mir-opt`
2020-10-26interning cleanup: we no longer need to distinguish Const and ConstInner; we ↵Ralf Jung-12/+0
no longer need the ignore_interior_mut_in_const hack
2020-10-21Lift: take self by valueBastian Kauschke-4/+4
2020-10-21Rollup merge of #78101 - RalfJung:foreign-static, r=oli-obkYuki Okushi-8/+9
fix static_ptr_ty for foreign statics Cc https://github.com/rust-lang/rust/issues/74840 This does not fix that issue but fixes a problem in `static_ptr_ty` that we noticed while discussing that issue. I also added and updated a few comments. The one about `internal` locals being ignored does not seem to have been true [even in the commit that introduced it](https://github.com/rust-lang/rust/pull/44700/files#diff-ae2f3c7e2f9744f7ef43e96072b10e98d4e3fe74a3a399a3ad8a810fbe56c520R139). r? @oli-obk
2020-10-21rustc_mir: support MIR-inlining #[track_caller] functions.Eduard-Mihai Burtescu-0/+9
2020-10-21rustc_mir: track inlined callees in SourceScopeData.Eduard-Mihai Burtescu-7/+40
2020-10-19fix Rvalue::ty for ThreadLocalRefRalf Jung-5/+9
2020-10-19remove what seems to be an outdated commentRalf Jung-3/+0
Even in the PR that introduced this comment, it does not seem like these locals are actually ignored -- just their `source_info` is adjusted: https://github.com/rust-lang/rust/pull/44700/files#diff-ae2f3c7e2f9744f7ef43e96072b10e98d4e3fe74a3a399a3ad8a810fbe56c520R139
2020-10-18Move orphan module-name/mod.rs files into module-name.rs filesest31-0/+0
2020-10-17Note that `BasicBlock` is just an indexCamelid-1/+4
2020-10-14Remove unused code from rustc_middleest31-86/+1
2020-10-13Replace absolute paths with relative onesest31-4/+4
Modern compilers allow reaching external crates like std or core via relative paths in modules outside of lib.rs and main.rs.
2020-10-13Auto merge of #77796 - jonas-schievink:switchint-refactor, r=oli-obkbors-27/+90
Refactor how SwitchInt stores jump targets Closes https://github.com/rust-lang/rust/issues/65693
2020-10-13Rollup merge of #77550 - lcnr:ty-dep-path-ct-cleanup, r=ecstatic-morseYuki Okushi-2/+34
add shims for WithOptConstParam query calls r? @ecstatic-morse @eddyb
2020-10-11Use SmallVec in SwitchTargetsJonas Schievink-9/+10
This allows building common SwitchTargets (eg. for `if`s) without allocation.
2020-10-10Refactor how SwitchInt stores jump targetsJonas Schievink-27/+89
2020-10-08Suggest removing &mut from borrow of &mutLzu Tao-1/+1
Fix a typo: minding -> binding Add test for &mut &mut
2020-10-06Rollup merge of #76995 - LingMan:middle_matches, r=varkorYuki Okushi-95/+59
Reduce boilerplate with the matches! macro Replaces simple bool `match`es of the form match $expr { $pattern => true _ => false } and their inverse with invocations of the matches! macro. Limited to rustc_middle for now to get my feet wet.
2020-10-05Updates to experimental coverage counter injectionRich Kadel-1/+20
This is a combination of 18 commits. Commit #2: Additional examples and some small improvements. Commit #3: fixed mir-opt non-mir extensions and spanview title elements Corrected a fairly recent assumption in runtest.rs that all MIR dump files end in .mir. (It was appending .mir to the graphviz .dot and spanview .html file names when generating blessed output files. That also left outdated files in the baseline alongside the files with the incorrect names, which I've now removed.) Updated spanview HTML title elements to match their content, replacing a hardcoded and incorrect name that was left in accidentally when originally submitted. Commit #4: added more test examples also improved Makefiles with support for non-zero exit status and to force validation of tests unless a specific test overrides it with a specific comment. Commit #5: Fixed rare issues after testing on real-world crate Commit #6: Addressed PR feedback, and removed temporary -Zexperimental-coverage -Zinstrument-coverage once again supports the latest capabilities of LLVM instrprof coverage instrumentation. Also fixed a bug in spanview. Commit #7: Fix closure handling, add tests for closures and inner items And cleaned up other tests for consistency, and to make it more clear where spans start/end by breaking up lines. Commit #8: renamed "typical" test results "expected" Now that the `llvm-cov show` tests are improved to normally expect matching actuals, and to allow individual tests to override that expectation. Commit #9: test coverage of inline generic struct function Commit #10: Addressed review feedback * Removed unnecessary Unreachable filter. * Replaced a match wildcard with remining variants. * Added more comments to help clarify the role of successors() in the CFG traversal Commit #11: refactoring based on feedback * refactored `fn coverage_spans()`. * changed the way I expand an empty coverage span to improve performance * fixed a typo that I had accidently left in, in visit.rs Commit #12: Optimized use of SourceMap and SourceFile Commit #13: Fixed a regression, and synched with upstream Some generated test file names changed due to some new change upstream. Commit #14: Stripping out crate disambiguators from demangled names These can vary depending on the test platform. Commit #15: Ignore llvm-cov show diff on test with generics, expand IO error message Tests with generics produce llvm-cov show results with demangled names that can include an unstable "crate disambiguator" (hex value). The value changes when run in the Rust CI Windows environment. I added a sed filter to strip them out (in a prior commit), but sed also appears to fail in the same environment. Until I can figure out a workaround, I'm just going to ignore this specific test result. I added a FIXME to follow up later, but it's not that critical. I also saw an error with Windows GNU, but the IO error did not specify a path for the directory or file that triggered the error. I updated the error messages to provide more info for next, time but also noticed some other tests with similar steps did not fail. Looks spurious. Commit #16: Modify rust-demangler to strip disambiguators by default Commit #17: Remove std::process::exit from coverage tests Due to Issue #77553, programs that call std::process::exit() do not generate coverage results on Windows MSVC. Commit #18: fix: test file paths exceeding Windows max path len
2020-10-05query_name_of_opt_const_arg -> query_name_opt_const_argBastian Kauschke-3/+3
2020-10-04cleanup WithOptConstParam queriesBastian Kauschke-1/+33
2020-10-04Remember the `MirSource` for each `Body`Dylan MacKenzie-1/+6
2020-10-04Move `MirSource` to `rustc_middle`Dylan MacKenzie-0/+32
2020-10-04Miscellaneous import formattingDylan MacKenzie-5/+4
2020-09-29Useful derives on `mir::LocalKind`Dylan MacKenzie-1/+1
2020-09-26Make invalid integer operation messages consistentvarkor-26/+30
2020-09-24Resolve https://github.com/rust-lang/rust/pull/76673#discussion_r494426303Simon Vandel Sillesen-0/+2
2020-09-24Auto merge of #77006 - oli-obk:🐌_const_queries, r=Mark-Simulacrumbors-1/+1
Cache `eval_to_allocation_raw` on disk https://github.com/rust-lang/rust/pull/74949#issuecomment-695833161 regressed the performance on these queries, this PR gets the perf back.