about summary refs log tree commit diff
path: root/tests/mir-opt
AgeCommit message (Collapse)AuthorLines
2023-11-14Auto merge of #117330 - tmiasko:custom-mir-cleanup-blocks, r=cjgillotbors-25/+127
Custom MIR: Support cleanup blocks Cleanup blocks are declared with `bb (cleanup) = { ... }`. `Call` and `Drop` terminators take an additional argument describing the unwind action, which is one of the following: * `UnwindContinue()` * `UnwindUnreachable()` * `UnwindTerminate(reason)`, where reason is `ReasonAbi` or `ReasonInCleanup` * `UnwindCleanup(block)` Also support unwind resume and unwind terminate terminators: * `UnwindResume()` * `UnwindTerminate(reason)`
2023-11-14Custom MIR: Support cleanup blocksTomasz Miąsko-25/+127
Cleanup blocks are declared with `bb (cleanup) = { ... }`. `Call` and `Drop` terminators take an additional argument describing the unwind action, which is one of the following: * `UnwindContinue()` * `UnwindUnreachable()` * `UnwindTerminate(reason)`, where reason is `ReasonAbi` or `ReasonInCleanup` * `UnwindCleanup(block)` Also support unwind resume and unwind terminate terminators: * `UnwindResume()` * `UnwindTerminate(reason)`
2023-11-13Compute layout with spans for better cycle errors in coroutinesMichael Goulet-2/+2
2023-11-08update mir-opt testslcnr-21/+21
2023-11-05Auto merge of #117537 - GKFX:offset-of-enum-feature, r=cjgillotbors-1/+1
Feature gate enums in offset_of As requested at https://github.com/rust-lang/rust/issues/106655#issuecomment-1790815262, put enums in offset_of behind their own feature gate. `@rustbot` label F-offset_of
2023-11-05Auto merge of #117469 - cjgillot:filecheck-mir, r=Mark-Simulacrumbors-119/+307
Add FileCheck annotations to a few MIR opt tests const_debuginfo did not specify which passes were running. const_prop_miscompile is renamed and moved to const_prop directory. while_storage was broken.
2023-11-03Feature gate enums in offset_ofGeorge Bateman-1/+1
2023-11-01Auto merge of #117498 - matthiaskrgr:rollup-z7mg4ck, r=matthiaskrgrbors-0/+445
Rollup of 4 pull requests Successful merges: - #117298 (Recover from missing param list in function definitions) - #117373 (Avoid the path trimming ICE lint in error reporting) - #117441 (Do not assert in op_to_const.) - #117488 (Update minifier-rs version to 0.3.0) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-01Auto merge of #117029 - rmehri01:mir_opt_filecheck_inline_tests, r=cjgillotbors-51/+156
Add FileCheck annotations to MIR-opt inlining tests Part of #116971, adds FileCheck annotations to MIR-opt tests in `tests/mir-opt/inline`. I left out a few (such as `inline_cycle`) where it mentioned that the particular outcome of inlining isn't important, just that the inliner doesn't get stuck in an infinite loop. r? cjgillot
2023-11-01Rebase fallout.Camille GILLOT-10/+2
2023-11-01Make ui into mir-opt test.Camille GILLOT-0/+453
2023-11-01fix spans for inline_couroutine panic-abortRyan Mehri-11/+11
2023-11-01Auto merge of #114208 - GKFX:offset_of_enum, r=wesleywiserbors-32/+229
Support enum variants in offset_of! This MR implements support for navigating through enum variants in `offset_of!`, placing the enum variant name in the second argument to `offset_of!`. The RFC placed it in the first argument, but I think it interacts better with nested field access in the second, as you can then write things like ```rust offset_of!(Type, field.Variant.field) ``` Alternatively, a syntactic distinction could be made between variants and fields (e.g. `field::Variant.field`) but I'm not convinced this would be helpful. [RFC 3308 # Enum Support](https://rust-lang.github.io/rfcs/3308-offset_of.html#enum-support-offset_ofsomeenumstructvariant-field_on_variant) Tracking Issue #106655.
2023-11-01Rollup merge of #115626 - clarfonthey:unchecked-math, r=thomccMatthias Krüger-1/+1
Clean up unchecked_math, separate out unchecked_shifts Tracking issue: #85122 Changes: 1. Remove `const_inherent_unchecked_arith` flag and make const-stability flags the same as the method feature flags. Given the number of other unsafe const fns already stabilised, it makes sense to just stabilise these in const context when they're stabilised. 2. Move `unchecked_shl` and `unchecked_shr` into a separate `unchecked_shifts` flag, since the semantics for them are unclear and they'll likely be stabilised separately as a result. 3. Add an `unchecked_neg` method exclusively to signed integers, under the `unchecked_neg` flag. This is because it's a new API and probably needs some time to marinate before it's stabilised, and while it *would* make sense to have a similar version for unsigned integers since `checked_neg` also exists for those there is absolutely no case where that would be a good idea, IMQHO. The longer-term goal here is to prepare the `unchecked_math` methods for an FCP and stabilisation since they've existed for a while, their semantics are clear, and people seem in favour of stabilising them.
2023-10-31Update MIR tests for offset_ofGeorge Bateman-44/+44
2023-10-31Support enum variants in offset_of!George Bateman-16/+213
2023-10-31FileCheck const_prop_miscompile.Camille GILLOT-24/+41
2023-10-31FileCheck const_debuginfo.Camille GILLOT-42/+66
2023-10-31FileCheck while_storage.Camille GILLOT-53/+200
2023-10-31change inline_retag to after.mirRyan Mehri-66/+60
2023-10-31FileCheck uninhabited_enum_branching.Camille GILLOT-245/+126
2023-10-31Only emit `!=` assumptions if the otherwise target is reachable.Camille GILLOT-51/+142
2023-10-31Refactor UninhabitedEnumBranching to mark targets unreachable.Camille GILLOT-6/+37
2023-10-31Simplify assume of a constant.Camille GILLOT-84/+62
2023-10-31Replace SwitchInt to unreachable by an assumption.Camille GILLOT-38/+93
2023-10-31Reorder passes.Camille GILLOT-33/+63
2023-10-29Auto merge of #116270 - cjgillot:gvn-aggregate, r=oli-obk,RalfJungbors-2449/+3545
See through aggregates in GVN This PR is extracted from https://github.com/rust-lang/rust/pull/111344 The first 2 commit are cleanups to avoid repeated work. I propose to stop removing useless assignments as part of this pass, and let a later `SimplifyLocals` do it. This makes tests easier to read (among others). The next 3 commits add a constant folding mechanism to the GVN pass, presented in https://github.com/rust-lang/rust/pull/116012. ~This pass is designed to only use global allocations, to avoid any risk of accidental modification of the stored state.~ The following commits implement opportunistic simplifications, in particular: - projections of aggregates: `MyStruct { x: a }.x` gets replaced by `a`, works with enums too; - projections of arrays: `[a, b][0]` becomes `a`; - projections of repeat expressions: `[a; N][x]` becomes `a`; - transform arrays of equal operands into a repeat rvalue. Fixes https://github.com/rust-lang/miri/issues/3090 r? `@oli-obk`
2023-10-27Auto merge of #103208 - cjgillot:match-fake-read, r=oli-obk,RalfJungbors-22/+71
Allow partially moved values in match This PR attempts to unify the behaviour between `let _ = PLACE`, `let _: TY = PLACE;` and `match PLACE { _ => {} }`. The logical conclusion is that the `match` version should not check for uninitialised places nor check that borrows are still live. The `match PLACE {}` case is handled by keeping a `FakeRead` in the unreachable fallback case to verify that `PLACE` has a legal value. Schematically, `match PLACE { arms }` in surface rust becomes in MIR: ```rust PlaceMention(PLACE) match PLACE { // Decision tree for the explicit arms arms, // An extra fallback arm _ => { FakeRead(ForMatchedPlace, PLACE); unreachable } } ``` `match *borrow { _ => {} }` continues to check that `*borrow` is live, but does not read the value. `match *borrow {}` both checks that `*borrow` is live, and fake-reads the value. Continuation of ~https://github.com/rust-lang/rust/pull/102256~ ~https://github.com/rust-lang/rust/pull/104844~ Fixes https://github.com/rust-lang/rust/issues/99180 https://github.com/rust-lang/rust/issues/53114
2023-10-26Auto merge of #113262 - Nilstrieb:rawr-casting, r=lcnrbors-15/+25
Never consider raw pointer casts to be trival HIR typeck tries to figure out which casts are trivial by doing them as coercions and seeing whether this works. Since HIR typeck is oblivious of lifetimes, this doesn't work for pointer casts that only change the lifetime of the pointee, which are, as borrowck will tell you, not trivial. This change makes it so that raw pointer casts are never considered trivial. This also incidentally fixes the "trivial cast" lint false positive on the same code. Unfortunately, "trivial cast" lints are now never emitted on raw pointer casts, even if they truly are trivial. This could be fixed by also doing the lint in borrowck for raw pointers specifically. fixes #113257
2023-10-25address review commentsRyan Mehri-70/+100
2023-10-25FileCheck unwrap_uncheckedRyan Mehri-1/+2
2023-10-25FileCheck unsized_argumentRyan Mehri-1/+2
2023-10-25FileCheck unchecked_shiftsRyan Mehri-1/+8
2023-10-25FileCheck issue_78442Ryan Mehri-1/+5
2023-10-25FileCheck inline_scopes_parentingRyan Mehri-4/+8
2023-10-25FileCheck inline_as_ref_as_mutRyan Mehri-1/+8
2023-10-25FileCheck inline_trait_methodRyan Mehri-1/+2
2023-10-25FileCheck inline_trait_method_2Ryan Mehri-1/+3
2023-10-25FileCheck inline_specializationRyan Mehri-1/+2
2023-10-25FileCheck inline_retagRyan Mehri-1/+2
2023-10-25FileCheck inline_optionsRyan Mehri-1/+3
2023-10-25FileCheck inline_into_box_placeRyan Mehri-1/+2
2023-10-25FileCheck inline_instruction_setRyan Mehri-1/+10
2023-10-25FileCheck inline_coroutineRyan Mehri-12/+14
2023-10-25FileCheck inline_divergingRyan Mehri-1/+7
2023-10-25FileCheck inline_closureRyan Mehri-1/+3
2023-10-25FileCheck inline_closure_capturesRyan Mehri-1/+3
2023-10-25FileCheck inline_closure_borrows_argRyan Mehri-1/+3
2023-10-25FileCheck inline_box_fnRyan Mehri-1/+2
2023-10-25FileCheck inline_any_operandRyan Mehri-1/+2