summary refs log tree commit diff
path: root/tests/mir-opt/inline
AgeCommit message (Collapse)AuthorLines
2024-09-24be even more precise about "cast" vs "coercion"Lukas Markeffsky-4/+4
2024-09-16Remove semi-nondeterminism of DefPathHash ordering from inlinerMichael Goulet-62/+4
2024-08-29Add a test for trait solver overflow in MIR inliner cycle detectionBen Kimock-0/+32
2024-08-18Bless *all* the mir-opt testsScott McMurray-109/+109
2024-07-29Perform instsimplify before inline to eliminate some trivial callsDianQK-30/+30
2024-07-01Avoid MIR bloat in inliningScott McMurray-48/+222
In 126578 we ended up with more binary size increases than expected. This change attempts to avoid inlining large things into small things, to avoid that kind of increase, in cases when top-down inlining will still be able to do that inlining later.
2024-06-10Delete `ConstDebugInfo` passScott McMurray-2/+2
2024-06-03rustfmt `tests/mir-opt`.Nicholas Nethercote-12/+19
The only non-obvious changes: - `building/storage_live_dead_in_statics.rs` has a `#[rustfmt::skip]` attribute to avoid reformating a table of data. - Two `.mir` files have slight changes involving line numbers. - In `unusual_item_types.rs` an `EMIT_MIR` annotation is moved to outside a function, which is the usual spot, because `tidy` complains if such a comment is indented. The commit also tweaks the comments in `rustfmt.toml`.
2024-05-29[ACP 362] genericize `ptr::from_raw_parts`Scott McMurray-1/+3
2024-05-25Simplify the `unchecked_sh[lr]` ub-checks a bitScott McMurray-4/+4
2024-05-23Add assert_unsafe_precondition to unchecked_{add,sub,neg,mul,shl,shr} methodsltdk-12/+92
2024-05-06Avoid a cast in `ptr::slice_from_raw_parts(_mut)`Scott McMurray-10/+46
Casting to `*const ()` or `*mut ()` just bloats the MIR, so let's not. If ACP#362 goes through we can keep calling `ptr::from_raw_parts(_mut)` in these also without the cast, but that hasn't had any libs-api attention yet, so I'm not waiting on it.
2024-04-24Error on using `yield` without also using `#[coroutine]` on the closureOli Scherer-23/+24
And suggest adding the `#[coroutine]` to the closure
2024-04-20mir-opt tests: rename unit-test -> test-mir-passRalf Jung-3/+3
2024-04-18Ensure `[rust] debuginfo-level-std` doesn't change core's MIRScott McMurray-0/+2
2024-04-18At debuginfo=0, don't inline debuginfo when inliningScott McMurray-44/+18
2024-04-03Remove MIR unsafe checkMatthew Jasper-82/+34
This also remove safety information from MIR.
2024-04-02Update tests/mir-opt/inline/unchecked_shifts.rsscottmcm-1/+1
Co-authored-by: Waffle Maybe <waffle.lapkin@gmail.com>
2024-03-30De-LLVM the unchecked shifts [MCP#693]Scott McMurray-328/+11
This is just one part of the MCP, but it's the one that IMHO removes the most noise from the standard library code. Seems net simpler this way, since MIR already supported heterogeneous shifts anyway, and thus it's not more work for backends than before.
2024-03-27Eliminate `UbCheck` for non-standard librariesDianQK-22/+4
2024-03-23Auto merge of #122629 - RalfJung:assert-unsafe-precondition, r=saethlinbors-4/+20
refactor check_{lang,library}_ub: use a single intrinsic This enacts the plan I laid out [here](https://github.com/rust-lang/rust/pull/122282#issuecomment-1996917998): use a single intrinsic, called `ub_checks` (in aniticpation of https://github.com/rust-lang/compiler-team/issues/725), that just exposes the value of `debug_assertions` (consistently implemented in both codegen and the interpreter). Put the language vs library UB logic into the library. This makes it easier to do something like https://github.com/rust-lang/rust/pull/122282 in the future: that just slightly alters the semantics of `ub_checks` (making it more approximating when crates built with different flags are mixed), but it no longer affects whether these checks can happen in Miri or compile-time. The first commit just moves things around; I don't think these macros and functions belong into `intrinsics.rs` as they are not intrinsics. r? `@saethlin`
2024-03-23refactor check_{lang,library}_ub: use a single intrinsic, put policy into ↵Ralf Jung-4/+20
library
2024-03-22Enable more mir-opt tests in debug buildsBen Kimock-3/+1
2024-03-10MIR printing: print the path of uneval'd const; refer to promoteds in a ↵Ralf Jung-6/+6
consistent way
2024-03-08Distinguish between library and lang UB in assert_unsafe_preconditionBen Kimock-4/+4
2024-02-25Auto merge of #121114 - Nilstrieb:no-inline!, r=saethlinbors-0/+83
Add `#[rustc_no_mir_inline]` for standard library UB checks should help with #121110 and also with #120848 Because the MIR inliner cannot know whether the checks are enabled or not, so inlining is an unnecessary compile time pessimization when debug assertions are disabled. LLVM knows whether they are enabled or not, so it can optimize accordingly without wasting time. r? `@saethlin`
2024-02-24Add `#[rustc_no_mir_inline]` for standard library UB checksNilstrieb-0/+83
Co-authored-by: Ben Kimock <kimockb@gmail.com>
2024-02-22[AUTO_GENERATED] Migrate compiletest to use `ui_test`-style `//@` directives许杰友 Jieyou Xu (Joe)-35/+35
2024-02-12Start blocks eagerlyNadrieril-12/+12
2024-02-08Bless/fix testsBen Kimock-73/+87
2024-02-06Use a better set of targets for blessing mir-opt testsBen Kimock-53/+13
2024-01-16Rename `pointer` field on `Pin`LegionMammal978-2/+2
The internal, unstable field of `Pin` can conflict with fields from the inner type accessed via the `Deref` impl. Rename it from `pointer` to `__pointer`, to make it less likely to conflict with anything else.
2024-01-11Sandwich MIR optimizations between DSE.Camille GILLOT-6/+6
2024-01-04Rollup merge of #119325 - RalfJung:custom-mir, r=compiler-errorsMatthias Krüger-1/+1
custom mir: make it clear what the return block is Custom MIR recently got support for specifying the "unwind action", so now there's two things coming after the actual call part of `Call` terminators. That's not very self-explaining so I propose we change the syntax to imitate keyword arguments: ``` Call(popped = Vec::pop(v), ReturnTo(drop), UnwindContinue()) ``` Also fix some outdated docs and add some docs to `Call` and `Drop`.
2023-12-30Update to bitflags 2 in the compilerNilstrieb-1/+1
This involves lots of breaking changes. There are two big changes that force changes. The first is that the bitflag types now don't automatically implement normal derive traits, so we need to derive them manually. Additionally, bitflags now have a hidden inner type by default, which breaks our custom derives. The bitflags docs recommend using the impl form in these cases, which I did.
2023-12-26custom mir: make it clear what the return block isRalf Jung-1/+1
2023-12-24Enable GVN by default.Camille GILLOT-2/+2
2023-12-11End locals' live range before suspending coroutineTomasz Miąsko-0/+2
State transforms retains storage statements for locals that are not stored inside a coroutine. It ensures those locals are live when resuming by inserting StorageLive as appropriate. It forgot to end the storage of those locals when suspending, which is fixed here. While the end of live range is implicit when executing return, it is nevertheless useful for inliner which would otherwise extend the live range beyond return.
2023-11-20Fix insertion of statements to be executed along return edge in inliningTomasz Miąsko-533/+135
Inlining creates additional statements to be executed along the return edge: an assignment to the destination, storage end for temporaries. Previously those statements where inserted directly into a call target, but this is incorrect when the target has other predecessors. Avoid the issue by creating a new dedicated block for those statements. When the block happens to be redundant it will be removed by CFG simplification that follows inlining. Fixes #117355
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-01fix spans for inline_couroutine panic-abortRyan Mehri-11/+11
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-31change inline_retag to after.mirRyan Mehri-66/+60
2023-10-31Only emit `!=` assumptions if the otherwise target is reachable.Camille GILLOT-32/+12
2023-10-31Simplify assume of a constant.Camille GILLOT-70/+56
2023-10-31Replace SwitchInt to unreachable by an assumption.Camille GILLOT-16/+44
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