summary refs log tree commit diff
path: root/compiler/rustc_mir/src/util
AgeCommit message (Collapse)AuthorLines
2021-07-14consistently treat None-tagged pointers as ints; get rid of some deprecated ↵Ralf Jung-1/+1
Scalar methods
2021-07-14CTFE/Miri engine Pointer type overhaul: make Scalar-to-Pointer conversion ↵Ralf Jung-9/+9
infallible This resolves all the problems we had around "normalizing" the representation of a Scalar in case it carries a Pointer value: we can just use Pointer if we want to have a value taht we are sure is already normalized.
2021-07-01Auto merge of #86304 - klensy:hex-length, r=jackh726bors-1/+21
rustc_mir: calc hex number length without string allocation
2021-07-01rustc_mir: calc hex number length without string allocationklensy-1/+21
2021-06-23Use `use_verbose` for mir::ConstantDeadbeef-27/+19
2021-06-17Rollup merge of #85870 - ptrojahn:mir_dump_whitespace, r=davidtwcoYuki Okushi-1/+4
Allow whitespace in dump_mir filter At least on my system this is necessary to get more complex filters with spaces like in https://rustc-dev-guide.rust-lang.org/mir/debugging.html working.
2021-06-01Allow whitespace in dump_mir filterPaul Trojahn-1/+4
2021-05-30Remove CrateNum::ReservedForIncrCompCachebjorn3-1/+0
2021-05-17remove size field from AllocationRalf Jung-6/+6
2021-05-17Auto merge of #85178 - cjgillot:local-crate, r=oli-obkbors-2/+2
Remove CrateNum parameter for queries that only work on local crate The pervasive `CrateNum` parameter is a remnant of the multi-crate rustc idea. Using `()` as query key in those cases avoids having to worry about the validity of the query key.
2021-05-12Spanview needs the relevant body_span used for coverageRich Kadel-7/+7
The coverage body_span doesn't always match the function body_span.
2021-05-12Use () for mir_keys.Camille GILLOT-2/+2
2021-05-11Split span_to_string into span_to_diagnostic/embeddable_stringAndy Wang-5/+8
2021-04-28spanview debug output caused ICE when a function had no bodyRich Kadel-9/+10
2021-04-19fix few typosklensy-1/+1
2021-04-02Auto merge of #83207 - oli-obk:valtree2, r=lcnrbors-2/+20
normalize mir::Constant differently from ty::Const in preparation for valtrees Valtrees are unable to represent many kind of constant values (this is on purpose). For constants that are used at runtime, we do not need a valtree representation and can thus use a different form of evaluation. In order to make this explicit and less fragile, I added a `fold_constant` method to `TypeFolder` and implemented it for normalization. Normalization can now, when it wants to eagerly evaluate a constant, normalize `mir::Constant` directly into a `mir::ConstantKind::Val` instead of relying on the `ty::Const` evaluation. In the future we can get rid of the `ty::Const` in there entirely and add our own `Unevaluated` variant to `mir::ConstantKind`. This would allow us to remove the `promoted` field from `ty::ConstKind::Unevaluated`, as promoteds can never occur in the type system. cc `@rust-lang/wg-const-eval` r? `@lcnr`
2021-03-31Add a new normalization query just for mir constantsOli Scherer-1/+5
2021-03-31Make unevaluated DefId rendering deterministicOli Scherer-1/+15
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