about summary refs log tree commit diff
path: root/src/test/mir-opt
AgeCommit message (Collapse)AuthorLines
2022-09-17Auto merge of #98588 - b-naber:valtrees-cleanup, r=lcnrbors-25/+24
Use only ty::Unevaluated<'tcx, ()> in type system r? `@lcnr`
2022-09-14address review againb-naber-374/+12
2022-09-14Prefer explict closure sig types over expected onesOli Scherer-1/+1
2022-09-13Use tcx.hir() utils for spans in MIR building.Camille GILLOT-161/+161
This corrects the `span_with_body` in the case of closures, which was incorrectly shortened to the `def_span`.
2022-09-13rebaseb-naber-42/+22
2022-09-13bless testsb-naber-8/+389
2022-09-08Remove ReEmptyJack Huey-44/+40
2022-09-08Rollup merge of #101399 - cjgillot:borrowck-binding-span, r=estebankDylan DPC-12/+12
Shrink span for bindings with subpatterns. Bindings with nested patterns (`binding @ pat` syntax) currently point to the full pattern. This PR proposes to shrink the span to stop before the ````@`.``` This makes the diagnostics for move/mutability conflicts clearer, as they not point to the `binding` only, instead of the full pat. r? ```@estebank```
2022-09-07Rollup merge of #101435 - JakobDegen:bitwidth-tests, r=wesleywiserMatthias Krüger-1152/+12
Remove unnecessary `EMIT_MIR_FOR_EACH_BITWIDTH` This commit removes the annotation only for those tests where the 32 bit and 64 bit files were exactly identical. I didn't touch anything in the `mir-opt/const` directory, since having this annotation there seems more principled, even if it doesn't make a difference. This also removes four additional files related to the `separate_const_switch.rs` test. The associated annotations were removed in #100827 , but I forgot to remove the files as well. (#97564 is the issue tracking an automated check here) r? ```@wesleywiser```
2022-09-06Shrink span for bindings with subpatterns.Camille GILLOT-12/+12
2022-09-06Test bumpOli Scherer-448/+2
2022-09-06Generalize the Assume intrinsic statement to a general Intrinsic statementOli Scherer-1/+1
2022-09-06Lower the assume intrinsic to a MIR statementOli Scherer-1/+120
2022-09-04Remove unnecessary `EMIT_MIR_FOR_EACH_BITWIDTHJakob Degen-1598/+12
2022-09-01Simplify MIR opt testsJakob Degen-1509/+742
This commit removes many cases of MIR opt tests emitting `.diff`s for more than one pass. These tests cannot be `unit-test`s, and so they are easy to break, and they also provide little value due to having excessively strong opinions over *how* a piece of code should be optimized. Where reasonable, we instead add separate test files that only emit the `PreCodegen.after` MIR for code where we want to track what the result of the net result of the optimization pipeline's output is.
2022-08-31Fix a bunch of typoDezhi Wu-1/+1
This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-30Refactor MIR phasesJakob Degen-49/+68
2022-08-29Rollup merge of #100239 - RalfJung:const-prop-uninit, r=oli-obkDylan DPC-1/+2
remove an ineffective check in const_prop Based on https://github.com/rust-lang/rust/pull/100043, only the last two commits are new. ConstProp has a special check when reading from a local that prevents reading uninit locals. However, if that local flows into `force_allocation`, then no check fires and evaluation proceeds. So this check is not really effective at preventing accesses to uninit locals. With https://github.com/rust-lang/rust/pull/100043, `read_immediate` and friends always fail when reading uninit locals, so I don't see why ConstProp would need a separate check. Thus I propose we remove it. This is needed to be able to do https://github.com/rust-lang/rust/pull/100085.
2022-08-28Use the declaration's SourceInfo for FnEntry retags, not the outermostBen Kimock-8/+8
2022-08-27remove an ineffective check in const_propRalf Jung-1/+2
2022-08-23./x.py test --blessTomasz Miąsko-149/+34
2022-08-22Auto merge of #99762 - Nilstrieb:unreachable-prop, r=oli-obkbors-155/+265
UnreachableProp: Preserve unreachable branches for multiple targets Before, UnreachablePropagation removed all unreachable branches. This was a pessimization, as it removed information about reachability that was used later in the optimization pipeline. For example, this code ```rust pub enum Two { A, B } pub fn identity(x: Two) -> Two { match x { Two::A => Two::A, Two::B => Two::B, } } ``` basically has `switchInt() -> [0: 0, 1: 1, otherwise: unreachable]` for the match. This allows it to be transformed into a simple `x`. If we remove the unreachable branch, the transformation becomes illegal. This was the problem keeping `UnreachablePropagation` from being enabled, so we can enable it now. Something similar already happened in #77800, but it did not show a perf improvement there. Let's try it again anyways! Fixes #68105, although that issue has been fixed for a long time (see #77680).
2022-08-22Auto merge of #100881 - Dylan-DPC:rollup-q9rr658, r=Dylan-DPCbors-38/+60
Rollup of 8 pull requests Successful merges: - #98200 (Expand potential inner `Or` pattern for THIR) - #99770 (Make some const prop mir-opt tests `unit-test`s) - #99957 (Rework Ipv6Addr::is_global to check for global reachability rather than global scope - rebase) - #100331 (Guarantee `try_reserve` preserves the contents on error) - #100336 (Fix two const_trait_impl issues) - #100713 (Convert diagnostics in parser/expr to SessionDiagnostic) - #100820 (Use pointer `is_aligned*` methods) - #100872 (Add guarantee that Vec::default() does not alloc) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-08-22Rollup merge of #99770 - Nilstrieb:mir-pass-unit-test, r=oli-obkDylan DPC-38/+60
Make some const prop mir-opt tests `unit-test`s Most of these have no or only tiny diffs beyond line numbers being changed (would it make sense to not have line numbers in mir-opt tests?). Some things changed a bit, but I think it should all be fine, not sure though.
2022-08-22bless mir-opt testsNilstrieb-384/+384
2022-08-21bless mir-opt testsNilstrieb-155/+265
2022-08-19Rollup merge of #100598 - ouz-a:91633, r=compiler-errorsDylan DPC-0/+197
Don't fix builtin index when Where clause is found Where clause shadows blanket impl for `Index` which causes normalization to not occur, which causes ICE to happen when we typeck. r? `@compiler-errors` Fixes #91633
2022-08-19Rollup merge of #100522 - cjgillot:inline-polymorphic-recursion, r=tmiaskoDylan DPC-0/+25
Only check the `DefId` for the recursion check in MIR inliner. The current history check compares `Instance`s, so it cannot detect cases of polymorphic recursion where `Substs` change. This PR makes it so we only compare `DefId`s, ignoring any change in `Substs`. According to https://github.com/rust-lang/rust/pull/100522#issuecomment-1214769757, in practice only very few inlining decisions change. Fixes https://github.com/rust-lang/rust/issues/100476
2022-08-17Ignore substs when checking inlining history.Camille GILLOT-0/+25
2022-08-17pass when where clause foundouz-a-0/+197
2022-08-14Update the minimum external LLVM to 13Josh Stone-1/+0
2022-08-12make some const prop tests unit-testNilstrieb-38/+60
2022-08-11Rollup merge of #100192 - tmiasko:rm-duplicated-locals, r=nagisaDylan DPC-26/+22
Remove duplicated temporaries creating during box derefs elaboration Temporaries created with `MirPatch::new_temp` will be declared after patch application. Remove manually created duplicate declarations. Removing duplicates exposes another issue. Visitor elaborates terminator twice and attempts to access new, but not yet available, local declarations. Remove duplicated call to `visit_terminator`. Extracted from #99946.
2022-08-10Auto merge of #100356 - matthiaskrgr:rollup-he0vkjc, r=matthiaskrgrbors-186/+167
Rollup of 8 pull requests Successful merges: - #99573 (Stabilize backtrace) - #100069 (Add error if link_ordinal used with unsupported link kind) - #100086 (Add more `// unit-test`s to MIR opt tests) - #100332 (Rename integer log* methods to ilog*) - #100334 (Suggest a missing semicolon before an array) - #100340 (Iterate generics_def_id_map in reverse order to fix P-critical issue) - #100345 (docs: remove repetition in `is_numeric` function docs) - #100352 (Update cargo) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-08-10Rollup merge of #100086 - JakobDegen:better-tests, r=wesleyweiserMatthias Krüger-186/+167
Add more `// unit-test`s to MIR opt tests I only changed things which are hopefully completely uninteresting. I plan to submit more PRs that cover more files, but those cases will need some more complicated (and hence possibly controversial) changes, so I'll try and submit those in reasonably sized batches. r? rust-lang/wg-mir-opt
2022-08-09Add more `// unit-test`s to MIR opt testsJakob Degen-186/+167
2022-08-10Rollup merge of #100314 - JakobDegen:test-docs, r=RalfJungMatthias Krüger-0/+12
Mention `unit-test` in MIR opt test README r? `@RalfJung`
2022-08-09Mention `unit-test` in MIR opt test READMEJakob Degen-0/+12
2022-08-07Remove even more box syntax uses from src/testest31-1/+1
Prior work, notably 6550021124451628b1efc60c59284465b109e3aa from #88316 has removed box syntax from most of the testsuite. However, some tests were left out. This commit removes box_syntax uses from more locations in src/test. Some tests that are very box syntax specific are not being migrated.
2022-08-06./x.py test --blessTomasz Miąsko-26/+22
2022-08-02Avoid invalidating the CFG in MirPatch.Jakob Degen-172/+0
As a part of this change, we adjust MirPatch to not needlessly create unnecessary resume blocks.
2022-07-28bless mir opt testsNilstrieb-9912/+9912
2022-07-26Allow try_to_raw_bytes on u8 arrayMichael Goulet-0/+307
2022-07-12ignore wasm=32 & blessouz-a-130/+133
2022-07-12add new rval, pull deref earlyouz-a-76/+68
2022-07-09tweak names and output and blessRalf Jung-217/+219
2022-07-07Shorten span for closures.Camille GILLOT-81/+81
2022-07-06fix miri-opt testsTakayuki Maeda-10/+10
2022-07-05Auto merge of #96862 - oli-obk:enum_cast_mir, r=RalfJungbors-0/+143
Change enum->int casts to not go through MIR casts. follow-up to https://github.com/rust-lang/rust/pull/96814 this simplifies all backends and even gives LLVM more information about the return value of `Rvalue::Discriminant`, enabling optimizations in more cases.
2022-07-04Auto merge of #98446 - nnethercote:derive-no-match-destructuring, r=scottmcmbors-66/+46
Don't use match-destructuring for derived ops on structs. r? `@scottmcm`