about summary refs log tree commit diff
path: root/compiler/rustc_mir/src/util
AgeCommit message (Collapse)AuthorLines
2021-03-29Auto merge of #83185 - jyn514:remove-dead-code, r=oli-obkbors-26/+0
Remove (lots of) dead code Builds on - [ ] https://github.com/rust-lang/rust/pull/83161 - [x] https://github.com/rust-lang/rust/pull/83230 - [x] https://github.com/rust-lang/rust/pull/83197. Found with https://github.com/est31/warnalyzer. See https://github.com/rust-lang/rust/pull/77739 for a similar change in the past. Dubious changes: - Maybe some of the dead code in rustc_data_structures should be kept, in case someone wants to use it in the future? TODO: - [ ] check if any of the comments on the deleted code should be kept. - [x] update the compiler documentation; right now it fails to build - [x] finish moving `cfg(test)` changes into https://github.com/rust-lang/rust/pull/83197 cc `@est31`
2021-03-28unaligned_references: align(N) fields in packed(N) structs are fineRalf Jung-11/+24
2021-03-27Address review commentsJoshua Nelson-6/+0
- Add back `HirIdVec`, with a comment that it will soon be used. - Add back `*_region` functions, with a comment they may soon be used. - Remove `-Z borrowck_stats` completely. It didn't do anything. - Remove `make_nop` completely. - Add back `current_loc`, which is used by an out-of-tree tool. - Fix style nits - Remove `AtomicCell` with `cfg(parallel_compiler)` for consistency.
2021-03-27Remove (lots of) dead codeJoshua Nelson-20/+0
Found with https://github.com/est31/warnalyzer. Dubious changes: - Is anyone else using rustc_apfloat? I feel weird completely deleting x87 support. - Maybe some of the dead code in rustc_data_structures, in case someone wants to use it in the future? - Don't change rustc_serialize I plan to scrap most of the json module in the near future (see https://github.com/rust-lang/compiler-team/issues/418) and fixing the tests needed more work than I expected. TODO: check if any of the comments on the deleted code should be kept.
2021-03-15s/ConstantSource/ConstantKind/Oli Scherer-2/+2
2021-03-12Prepare mir::Constant for ty::Const only supporting valtreesOli Scherer-5/+10
2021-03-09Update match brancheskadmin-0/+1
This updates all places where match branches check on StatementKind or UseContext. This doesn't properly implement them, but adds TODOs where they are, and also adds some best guesses to what they should be in some cases.
2021-03-08Auto merge of #82727 - oli-obk:shrinkmem, r=pnkfelixbors-4/+10
Test the effect of shrinking the size of Rvalue by 16 bytes r? `@ghost`
2021-03-05Shrink the size of Rvalue by 16 bytesOli Scherer-4/+10
2021-03-01Box generator-related Body fieldsDániel Buga-2/+2
2021-02-26Miscellaneous inlining improvementsTomasz Miąsko-0/+1
Inline a few small and hot functions.
2021-02-22Fix mir-cfg dumpsÖmer Sinan Ağacan-5/+18
Fixes #81918 Fixes #82326 (duplicate) Fixes #82325
2021-02-17Remove redundant rustc_data_structures path componentest31-4/+4
2021-02-13Fix MIR pretty printer for non-local DefIdsÖmer Sinan Ağacan-13/+13
2021-01-27Visit only statements in always live localsTomasz Miąsko-19/+12
No functional changes intended.
2021-01-16Use PlaceRef more consistently in rustc_mirOlivia Crain-5/+2
2021-01-11--emit=mir now emits both `mir_for_ctfe` and `optimized_mir` for `const fn`oli-11/+21
2021-01-05Remove a FIXME and explain the decisionoli-1/+2
2021-01-04Keep an unoptimized duplicate of `const fn` aroundoli-1/+5
This allows CTFE to reliably detect UB, as otherwise optimizations may hide UB.
2020-12-25Rollup merge of #79999 - hencrice:yenlinc/79799, r=oli-obkDylan DPC-11/+17
Refactored verbose print into a function Also handle Tuple and Array separately, which was not explicitly checked. Fixes #79799.
2020-12-24Auto merge of #77692 - PankajChaudhary5:issue-76630, r=davidtwcobors-3/+4
Added better error message for shared borrow treated as unique for purposes of lifetimes Part of Issue #76630 r? `@jyn514`
2020-12-23Fixed formattingYenlin Chen-3/+1
2020-12-23Addressed feedbacksYenlin Chen-17/+3
Also updated the mir-opt test output files.
2020-12-15Auto merge of #78399 - vn-ki:gsgdt-graphviz, r=oli-obkbors-133/+89
make MIR graphviz generation use gsgdt gsgdt [https://crates.io/crates/gsgdt] is a crate which provides an interface for stringly typed graphs. It also provides generation of graphviz dot format from said graph. This is the first in a series of PRs on moving graphviz code out of rustc into normal crates and then implementating graph diffing on top of these crates. r? `@oli-obk`
2020-12-15Auto merge of #73210 - wesleywiser:consts_in_debuginfo, r=oli-obkbors-2/+2
[mir-opt] Allow debuginfo to be generated for a constant or a Place Prior to this commit, debuginfo was always generated by mapping a name to a Place. This has the side-effect that `SimplifyLocals` cannot remove locals that are only used for debuginfo because their other uses have been const-propagated. To allow these locals to be removed, we now allow debuginfo to point to a constant value. The `ConstProp` pass detects when debuginfo points to a local with a known constant value and replaces it with the value. This allows the later `SimplifyLocals` pass to remove the local.
2020-12-13Refactored verbose print into a functionYenlin Chen-11/+33
Also handle Tuple and Array separately, which was not explicitly checked. Fixes #79799.
2020-12-06[mir-opt] Allow debuginfo to be generated for a constant or a PlaceWesley Wiser-2/+2
Prior to this commit, debuginfo was always generated by mapping a name to a Place. This has the side-effect that `SimplifyLocals` cannot remove locals that are only used for debuginfo because their other uses have been const-propagated. To allow these locals to be removed, we now allow debuginfo to point to a constant value. The `ConstProp` pass detects when debuginfo points to a local with a known constant value and replaces it with the value. This allows the later `SimplifyLocals` pass to remove the local.
2020-12-03Coverage tests for remaining TerminatorKinds and async, improve AssertRich Kadel-2/+6
Tested and validate results for panic unwind, panic abort, assert!() macro, TerminatorKind::Assert (for example, numeric overflow), and async/await. Implemented a previous documented idea to change Assert handling to be the same as FalseUnwind and Goto, so it doesn't get its own BasicCoverageBlock anymore. This changed a couple of coverage regions, but I validated those changes are not any worse than the prior results, and probably help assure some consistency (even if some people might disagree with how the code region is consistently computed). Fixed issue with async/await. AggregateKind::Generator needs to be handled like AggregateKind::Closure; coverage span for the outer async function should not "cover" the async body, which is actually executed in a separate "closure" MIR.
2020-12-01Added better error message for shared borrow treated as unique for purposes ↵PankajChaudhary5-3/+4
of lifetimes
2020-11-14Introduce `TypeVisitor::BreakTy`LeSeulArtichaut-1/+1
2020-11-12add different color for cleanup nodes in dark modeVishnunarayan K I-1/+2
2020-11-10formattingVishnunarayan K I-1/+1
2020-11-09update gsgdtVishnunarayan K I-6/+5
2020-11-09write to a String instead to reduce churnVishnunarayan K I-14/+21
2020-11-09make MIR graphviz generation use gsgdtVishnunarayan K I-147/+96
gsgdt [https://crates.io/crates/gsgdt] is a crate which provides an interface for stringly typed graphs. It also provides generation of graphviz dot format from said graph.
2020-11-07use single char patterns for split() (clippy::single_char_pattern)Matthias Krüger-1/+1
2020-11-05Adds coverage graphvizRich Kadel-0/+186
2020-11-05Rust coverage before splitting instrument_coverage.rsRich Kadel-1/+3
2020-11-04s/Scalar::Raw/Scalar::Intoli-1/+1
2020-10-30Remove implicit `Continue` typeLeSeulArtichaut-1/+1
2020-10-30TypeVisitor: use `ControlFlow` in rustc_{mir,privacy,traits,typeck}LeSeulArtichaut-1/+2
2020-10-21rustc_mir: support MIR-inlining #[track_caller] functions.Eduard-Mihai Burtescu-5/+18
2020-10-21rustc_mir: track inlined callees in SourceScopeData.Eduard-Mihai Burtescu-2/+17
2020-10-17Remove the old copy propagation passJonas Schievink-159/+0
2020-10-11Use SmallVec in SwitchTargetsJonas Schievink-3/+1
This allows building common SwitchTargets (eg. for `if`s) without allocation.
2020-10-10Refactor how SwitchInt stores jump targetsJonas Schievink-6/+8
2020-10-06Rollup merge of #77559 - camelid:fix-rustdoc-warnings-invalid-rust-syntax, ↵Yuki Okushi-1/+2
r=lcnr Fix rustdoc warnings about invalid Rust syntax
2020-10-05Renamed tests to avoid exceeding Windows max path limitRich Kadel-7/+1
2020-10-05Updates to experimental coverage counter injectionRich Kadel-48/+92
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-05Auto merge of #77552 - ecstatic-morse:body-def-id, r=lcnrbors-13/+10
Replace `(Body, DefId)` with `Body` where possible Follow-up to #77430. I `grep`-ed for parameter lists in which a `Body` appeared within a few lines of a `DefId`, so it's possible that I missed some cases, but this should be pretty complete. Most of these changes were mechanical, but there's a few places where I started calling things "caller" and "callee" when multiple `DefId`s were in-scope at once. Also, we should probably have a helper function on `Body` that returns a `LocalDefId`. I can do that in this PR or in a follow-up.