about summary refs log tree commit diff
path: root/tests/mir-opt/dataflow-const-prop
AgeCommit message (Collapse)AuthorLines
2025-09-16Remove Rvalue::Len.Camille Gillot-0/+342
2025-01-18Update tests for std::simd subtree syncCaleb Zulawski-8/+8
2025-01-15Less unsafe in `dangling`/`without_provenance`Scott McMurray-392/+180
2025-01-08[mir-opt] GVN some more transmute casesScott McMurray-16/+16
We already did `Transmute`-then-`PtrToPtr`; this adds the nearly-identical `PtrToPtr`-then-`Transmute`. It also adds `transmute(Foo(x))` → `transmute(x)`, when `Foo` is a single-field transparent type. That's useful for things like `NonNull { pointer: p }.as_ptr()`. Found these as I was looking at MCP807-related changes.
2025-01-06Transmute from NonNull to pointer when elaborating a box deref (MCP807)Scott McMurray-2/+2
2024-12-03Bounds-check with PtrMetadata instead of Len in MIRScott McMurray-429/+53
2024-09-24be even more precise about "cast" vs "coercion"Lukas Markeffsky-8/+8
2024-08-18Bless *all* the mir-opt testsScott McMurray-254/+254
2024-08-18Update mir-opt filechecksScott McMurray-22/+22
2024-07-29Stabilize offset_of_nestedGeorge Bateman-2/+0
2024-07-29Perform instsimplify before inline to eliminate some trivial callsDianQK-1/+1
2024-07-15Ignore allocation bytes in one more mir-opt testUlrich Weigand-4/+3
Following on PR #126502, add `rustc -Zdump-mir-exclude-alloc-bytes` to tests/mir-opt/dataflow-const-prop/aggregate_copy.rs as well to skip writing allocation bytes in MIR dumps. Fixes #126261
2024-07-13Propagate places through assignments.Camille GILLOT-20/+59
2024-07-13Add test for copying aggregates.Camille GILLOT-0/+95
2024-07-13Create mapped places upon seeing them in the body.Camille GILLOT-56/+27
2024-06-26Bless mir-opt for excluded alloc bytesJosh Stone-232/+102
2024-06-26Use `-Zdump-mir-exclude-alloc-bytes` in some mir-opt testsJosh Stone-2/+5
2024-06-19Ban `ArrayToPointer` and `MutToConstPointer` from runtime MIRScott McMurray-4/+4
Apparently MIR borrowck cares about at least one of these for checking variance. In runtime MIR, though, there's no need for them as `PtrToPtr` does the same thing. (Banning them simplifies passes like GVN that no longer need to handle multiple cast possibilities.)
2024-06-03rustfmt `tests/mir-opt`.Nicholas Nethercote-10/+28
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-06-03Reformat `mir!` macro invocations to use braces.Nicholas Nethercote-2/+2
The `mir!` macro has multiple parts: - An optional return type annotation. - A sequence of zero or more local declarations. - A mandatory starting anonymous basic block, which is brace-delimited. - A sequence of zero of more additional named basic blocks. Some `mir!` invocations use braces with a "block" style, like so: ``` mir! { let _unit: (); { let non_copy = S(42); let ptr = std::ptr::addr_of_mut!(non_copy); // Inside `callee`, the first argument and `*ptr` are basically // aliasing places! Call(_unit = callee(Move(*ptr), ptr), ReturnTo(after_call), UnwindContinue()) } after_call = { Return() } } ``` Some invocations use parens with a "block" style, like so: ``` mir!( let x: [i32; 2]; let one: i32; { x = [42, 43]; one = 1; x = [one, 2]; RET = Move(x); Return() } ) ``` And some invocations uses parens with a "tighter" style, like so: ``` mir!({ SetDiscriminant(*b, 0); Return() }) ``` This last style is generally used for cases where just the mandatory starting basic block is present. Its braces are placed next to the parens. This commit changes all `mir!` invocations to use braces with a "block" style. Why? - Consistency is good. - The contents of the invocation is a block of code, so it's odd to use parens. They are more normally used for function-like macros. - Most importantly, the next commit will enable rustfmt for `tests/mir-opt/`. rustfmt is more aggressive about formatting macros that use parens than macros that use braces. Without this commit's changes, rustfmt would break a couple of `mir!` macro invocations that use braces within `tests/mir-opt` by inserting an extraneous comma. E.g.: ``` mir!(type RET = (i32, bool);, { // extraneous comma after ';' RET.0 = 1; RET.1 = true; Return() }) ``` Switching those `mir!` invocations to use braces avoids that problem, resulting in this, which is nicer to read as well as being valid syntax: ``` mir! { type RET = (i32, bool); { RET.0 = 1; RET.1 = true; Return() } } ```
2024-05-17Remove `Rvalue::CheckedBinaryOp`Scott McMurray-6/+6
2024-04-28Update mir-opt tests, add proper regression testGeorge Bateman-192/+68
2024-04-20mir-opt tests: rename unit-test -> test-mir-passRalf Jung-23/+23
2024-04-18At debuginfo=0, don't inline debuginfo when inliningScott McMurray-36/+0
2024-04-03Remove MIR unsafe checkMatthew Jasper-226/+134
This also remove safety information from MIR.
2024-03-23Auto merge of #122629 - RalfJung:assert-unsafe-precondition, r=saethlinbors-8/+40
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-8/+40
library
2024-03-22Enable more mir-opt tests in debug buildsBen Kimock-1/+0
2024-03-10MIR printing: print the path of uneval'd const; refer to promoteds in a ↵Ralf Jung-20/+20
consistent way
2024-03-08Distinguish between library and lang UB in assert_unsafe_preconditionBen Kimock-32/+64
2024-02-22[AUTO_GENERATED] Migrate compiletest to use `ui_test`-style `//@` directives许杰友 Jieyou Xu (Joe)-30/+30
2024-02-21rename ptr::invalid -> ptr::without_provenanceRalf Jung-64/+80
also introduce ptr::dangling matching NonNull::dangling
2024-02-19Always evaluate free constants and statics, even if previous errors occurredOli Scherer-1/+1
2024-02-13Rollup merge of #120978 - Nadrieril:sane-blocks, r=matthewjasperMatthias Krüger-49/+49
match lowering: simplify block creation Match lowering was doing complicated things with block creation. As far as I can tell it was trying to avoid creating unneeded blocks, but of the three places that start out with `otherwise = &mut None`, two of them called `otherwise.unwrap_or_else(|| self.cfg.start_new_block())` anyway. As far as I can tell the only place where this PR makes a difference is in `lower_match_tree`, which did indeed sometimes avoid creating the unreachable final block + FakeRead. Unless this is important I propose we do the naive thing instead. I have not checked all the graph isomorphisms by hand, but at a glance the test diff looks sensible. r? `@matthewjasper`
2024-02-12Start blocks eagerlyNadrieril-49/+49
2024-02-09Const-prop pointers.Camille GILLOT-68/+185
2024-02-08Bless/fix testsBen Kimock-284/+240
2024-02-04Rollup merge of #119759 - sfzhu93:master, r=cjgillotMatthias Krüger-87/+394
Add FileCheck annotations to dataflow-const-prop tests part of #116971. A few shadowing variable names are changed, so that it is easier to match the variable names in MIR using FileCheck syntax. Also, there's a FIXME in [enum.rs](https://github.com/rust-lang/rust/pull/119759/files#diff-7621f55327838e489a95ac99ae1e6126b37c57aff582594e6bee9d7e7e56fc58) because the MIR looks suspicious to me. It has been explained in the comments. r? cjgillot
2024-01-28update terminator.rssfzhu93-1/+1
2024-01-22update enum.rssfzhu93-2/+0
2024-01-20finish a pattern in `enum.rs`sfzhu93-1/+1
2024-01-20update misuse of check-labelsfzhu93-8/+8
2024-01-19Remove feature(offset_of) from testsGeorge Bateman-1/+1
2024-01-14add FIXME for default_boxed_slice.rssfzhu93-3/+6
2024-01-12update enum.rs for code reviewsfzhu93-1/+10
2024-01-11resolve code reviewssfzhu93-3/+8
2024-01-11resolve code reviewssfzhu93-96/+118
2024-01-11Sandwich MIR optimizations between DSE.Camille GILLOT-48/+72
2024-01-08Add FileCheck for enum.rssfzhu93-2/+2
2024-01-08Add FileCheck to terminator.rs and tuple.rssfzhu93-2/+18