about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform
AgeCommit message (Collapse)AuthorLines
2021-11-30Separate `RemoveFalseEdges` from `SimplifyBranches`Dylan MacKenzie-15/+38
Otherwise dataflow state will propagate along false edges and cause things to be marked as maybe init unnecessarily. These should be separate, since `SimplifyBranches` also makes `if true {} else {}` into a `goto`, which means we wouldn't lint anything in the `else` block.
2021-11-30Rollup merge of #91294 - cjgillot:process-elem, r=jackh726Matthias Krüger-42/+0
Visit type in process_projection_elem. Instead of reimplementing it for each visitor.
2021-11-29Don't re-export `MirPass`Dylan MacKenzie-2/+1
2021-11-27Visit type in process_projection_elem.Camille GILLOT-42/+0
2021-11-26Small mir-opt refactorScott McMurray-23/+3
Hopefully-non-controversial changes from some not-ready-yet work that I'd figured I'd submit on their own.
2021-11-20Fix a variant index and variant discriminant confusionTomasz Miąsko-1/+4
Previously for enums using the `Variants::Single` layout, the variant index was being confused with its discriminant. For example, in the case of `enum E { A = 1 }`. Use `discriminant_for_variant` to avoid the issue.
2021-11-20Use `IndexVec::indices` instead of reimplementing itTomasz Miąsko-6/+2
The change is limited to the iteration over indices instead of using `basic_blocks_mut()` directly, in the case the previous implementation intentionally avoided invalidating the caches stored in MIR body.
2021-11-20Remove redundant check for promotedsTomasz Miąsko-4/+0
For some time CTFE has been using a dedicated MIR which is never optimized, so the check for promoted became redundant.
2021-11-08impl Copy/Clone for arrays in std, not in compilerbstrie-149/+0
2021-11-06Rollup merge of #90649 - cjgillot:reveal-all-2, r=lcnrMatthias Krüger-1/+1
Run reveal_all on MIR when inlining is activated. Fix logic error in https://github.com/rust-lang/rust/pull/85254 which prevented the pass from running when needed. Fixes https://github.com/rust-lang/rust/issues/78442 r? ``@lcnr``
2021-11-06use matches!() macro in more placesMatthias Krüger-8/+6
2021-11-06Run reveal_all on MIR more often.Camille GILLOT-1/+1
2021-10-28Revert "Add rustc lint, warning when iterating over hashmaps"Mark Rousskov-1/+0
2021-10-25Auto merge of #90042 - pietroalbini:1.56-master, r=Mark-Simulacrumbors-1/+0
Bump bootstrap compiler to 1.57 Fixes https://github.com/rust-lang/rust/issues/90152 r? `@Mark-Simulacrum`
2021-10-24Auto merge of #90235 - matthiaskrgr:rollup-7pqtevk, r=matthiaskrgrbors-0/+1
Rollup of 6 pull requests Successful merges: - #89558 (Add rustc lint, warning when iterating over hashmaps) - #90100 (Skip documentation for tier 2 targets on dist-x86_64-apple-darwin) - #90155 (Fix alignment of method headings for scannability) - #90162 (Mark `{array, slice}::{from_ref, from_mut}` as const fn) - #90221 (Fix ICE when forgetting to `Box` a parameter to a `Self::func` call) - #90234 (Temporarily turn overflow checks off for rustc-rayon-core) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-10-24Rollup merge of #89558 - lcnr:query-stable-lint, r=estebankMatthias Krüger-0/+1
Add rustc lint, warning when iterating over hashmaps r? rust-lang/wg-incr-comp
2021-10-24Auto merge of #85254 - cjgillot:reveal-mir, r=lcnrbors-1/+61
Normalize MIR with RevealAll before optimizations. Fixes #78442
2021-10-23update cfg(bootstrap)Pietro Albini-1/+0
2021-10-22Auto merge of #89893 - camsteffen:redundant-dump-enabled, r=matthewjasperbors-29/+7
Remove redundant dump_enabled check
2021-10-21Rollup merge of #90071 - cjgillot:no-blocks, r=oli-obkYuki Okushi-7/+4
Remove hir::map::blocks and use FnKind instead The principal tool is `FnLikeNode`, which is not often used and can be easily implemented using `rustc_hir::intravisit::FnKind`.
2021-10-20Remove `box_alloc` from `Machine` trait.Gary Guo-7/+0
2021-10-19Replace FnLikeNode by FnKind.Camille GILLOT-7/+4
2021-10-19Auto merge of #89933 - est31:let_else, r=michaelwoeristerbors-16/+8
Adopt let_else across the compiler This performs a substitution of code following the pattern: ``` let <id> = if let <pat> = ... { identity } else { ... : ! }; ``` To simplify it to: ``` let <pat> = ... { identity } else { ... : ! }; ``` By adopting the `let_else` feature (cc #87335). The PR also updates the syn crate because the currently used version of the crate doesn't support `let_else` syntax yet. Note: Generally I'm the person who *removes* usages of unstable features from the compiler, not adds more usages of them, but in this instance I think it hopefully helps the feature get stabilized sooner and in a better state. I have written a [comment](https://github.com/rust-lang/rust/issues/87335#issuecomment-944846205) on the tracking issue about my experience and what I feel could be improved before stabilization of `let_else`.
2021-10-18Auto merge of #89124 - cjgillot:owner-info, r=michaelwoeristerbors-10/+6
Index and hash HIR as part of lowering Part of https://github.com/rust-lang/rust/pull/88186 ~Based on https://github.com/rust-lang/rust/pull/88880 (see merge commit).~ Once HIR is lowered, it is later indexed by the `index_hir` query and hashed for `crate_hash`. This PR moves those post-processing steps to lowering itself. As a side objective, the HIR crate data structure is refactored as an `IndexVec<LocalDefId, Option<OwnerInfo<'hir>>>` where `OwnerInfo` stores all the relevant information for an HIR owner. r? `@michaelwoerister` cc `@petrochenkov`
2021-10-17Fix remove_unneeded_drops pass.Camille GILLOT-1/+1
2021-10-17Normalize MIR with RevealAll before optimizations.Camille GILLOT-0/+60
2021-10-16Adopt let_else across the compilerest31-16/+8
This performs a substitution of code following the pattern: let <id> = if let <pat> = ... { identity } else { ... : ! }; To simplify it to: let <pat> = ... { identity } else { ... : ! }; By adopting the let_else feature.
2021-10-15allow `potential_query_instability` everywherelcnr-0/+1
2021-10-14Inline on_mir_pass and add inline to dump_mirCameron Steffen-27/+7
2021-10-14Allow to hash HIR for coverage.Camille GILLOT-10/+6
2021-10-14Remove redundant dump_enabled checkCameron Steffen-4/+2
2021-10-08clippy::complexity fixesMatthias Krüger-3/+2
2021-10-06opt-level >= 4Alexander-3/+3
2021-10-06fix importAlexander-1/+1
2021-10-06reset and cleanupAlexander-0/+289
2021-10-05Auto merge of #89266 - cjgillot:session-ich, r=michaelwoeristerbors-1/+2
Move ICH to rustc_query_system Based on https://github.com/rust-lang/rust/pull/89183 The StableHashingContext does not need to be in rustc_middle. This PR moves it to rustc_query_system. This will avoid a dependency between rustc_ast_lowering and rustc_middle in https://github.com/rust-lang/rust/pull/89124.
2021-10-04Rollup merge of #89508 - jhpratt:stabilize-const_panic, r=joshtriplettJubilee-1/+1
Stabilize `const_panic` Closes #51999 FCP completed in #89006 ```@rustbot``` label +A-const-eval +A-const-fn +T-lang cc ```@oli-obk``` for review (not `r?`'ing as not on lang team)
2021-10-04Auto merge of #89489 - FabianWolff:issue-89485, r=oli-obkbors-8/+34
Fix unsound optimization with explicit variant discriminants Fixes #89485.
2021-10-04Stabilize `const_panic`Jacob Pratt-1/+1
2021-10-03Disable `SimplifyBranchSame` optimization for nowFabian Wolff-0/+6
2021-10-03Update commentsFabian Wolff-8/+18
2021-10-03Remove re-export.Camille GILLOT-1/+2
2021-10-03Fix unsound optimization with explicit variant discriminantsFabian Wolff-4/+14
2021-10-02Make diangostic item names consistentCameron Steffen-1/+1
2021-10-01Auto merge of #88880 - cjgillot:no-krate, r=oli-obkbors-4/+2
Rework HIR API to make invocations of the hir_crate query harder. `hir_crate` forces the recomputation of queries that depend on it. This PR aims at avoiding useless invocations of `hir_crate` by making dependent code go through `tcx.hir()`.
2021-10-01Rollup merge of #89415 - wesleywiser:inliner_caller_callsite_message, ↵Manish Goregaokar-1/+1
r=michaelwoerister Correct caller/callsite confusion in inliner message `callee_body` is the MIR `Body` for the `callsite.callee` so this message basically says `"Inline {bar span} into bar"` when it should say `"Inline bar into foo"`. Extracted out of #82280
2021-09-30Correct caller/callsite confusion in inliner messageWesley Wiser-1/+1
2021-09-29Move body_owners to tcx.hir().Camille GILLOT-1/+1
2021-09-29Avoid more invocations of hir_crate query.Camille GILLOT-3/+1
2021-09-28Rebase resume argument projections during state transformTomasz Miąsko-2/+3
When remapping a resume argument with projections rebase them on top of the new base. The case where resume argument has projections is unusual, but might arise with box syntax where the assignment is performed directly into the box without an intermediate temporary.