about summary refs log tree commit diff
path: root/tests/mir-opt/const_prop
AgeCommit message (Collapse)AuthorLines
2025-07-23Give an AllocId to ConstValue::Slice.Camille GILLOT-0/+8
2025-07-01Store a full Ty with each Value.Camille GILLOT-3/+3
2025-04-04Allow GVN to produce places and not just locals.Camille GILLOT-4/+2
2025-04-03Invalid dereferences for all non-local mutationsdianqk-2/+4
2025-04-02Bless testsdianqk-15/+21
2025-04-02Revert "comment out the old tests instead of adjusting them"dianqk-7/+4
This reverts commit 906f66fb4c22daa8a6f97e5c048e9f6ab3fd9051.
2025-04-02Do not use `for_each_assignment_mut` to iterate over assignment statementsdianqk-2/+4
`for_each_assignment_mut` can skip assignment statements with side effects, which can result in some assignment statements retrieving outdated value. For example, it may skip a dereference assignment statement.
2025-01-27Reapply "Auto merge of #133734 - scottmcm:lower-indexing-to-ptrmetadata, ↵Michael Goulet-108/+80
r=davidtwco,RalfJung" This reverts commit 122a55bb442bd1995df9cf9b36e6f65ed3ef4a1d.
2025-01-18Revert "Auto merge of #133734 - scottmcm:lower-indexing-to-ptrmetadata, ↵Rémy Rakic-96/+116
r=davidtwco,RalfJung" This reverts commit b57d93d8b9525fa261404b4cd9c0670eeb1264b8, reversing changes made to 0aeaa5eb22180fdf12a8489e63c4daa18da6f236.
2025-01-06Transmute from NonNull to pointer when elaborating a box deref (MCP807)Scott McMurray-8/+8
2025-01-03turn rustc_box into an intrinsicRalf Jung-4/+2
2024-12-03Bounds-check with PtrMetadata instead of Len in MIRScott McMurray-116/+96
2024-11-25comment out the old tests instead of adjusting themRalf Jung-4/+7
2024-11-25Do not unify dereferences in GVN.Camille GILLOT-37/+27
2024-09-24be even more precise about "cast" vs "coercion"Lukas Markeffsky-15/+15
2024-08-19Auto merge of #122551 - RayMuir:copy_fmt, r=saethlinbors-198/+198
Added "copy" to Debug fmt for copy operands In MIR's debug mode (--emit mir) the printing for Operands is slightly inconsistent. The RValues - values on the right side of an Assign - are usually printed with their Operand when they are Places. Example: _2 = move _3 But for arguments, the operand is omitted. _2 = _1 I propose a change be made, to display the place with the operand. _2 = copy _1 Move and copy have different semantics, meaning this difference is important and helpful to the user. It also adds consistency to the pretty printing. -- EDIT -- Consider this example Rust program and its MIR output with the **updated pretty printer.** This was generated with the arguments --emit mir --crate-type lib -Zmir-opt-level=0 (Otherwise, it's optimised away since it's a junk program). ```rust fn main(foo: i32) { let v = 10; if v == 20 { foo; } else { v; } } ``` ```MIR // WARNING: This output format is intended for human consumers only // and is subject to change without notice. Knock yourself out. fn main(_1: i32) -> () { debug foo => _1; let mut _0: (); let _2: i32; let mut _3: bool; let mut _4: i32; let _5: i32; let _6: i32; scope 1 { debug v => _2; } bb0: { StorageLive(_2); _2 = const 10_i32; StorageLive(_3); StorageLive(_4); _4 = copy _2; _3 = Eq(move _4, const 20_i32); switchInt(move _3) -> [0: bb2, otherwise: bb1]; } bb1: { StorageDead(_4); StorageLive(_5); _5 = copy _1; StorageDead(_5); _0 = const (); goto -> bb3; } bb2: { StorageDead(_4); StorageLive(_6); _6 = copy _2; StorageDead(_6); _0 = const (); goto -> bb3; } bb3: { StorageDead(_3); StorageDead(_2); return; } } ``` In this example program, we can see that when we move a place, it is preceded by "move". e.g. ``` _3 = Eq(move _4, const 20_i32);```. However, when we copy a place such as ```_5 = _1;```, it is not preceded by the operand in the original printout. I propose to change the print to include the copy ```_5 = copy _1``` as in this example. Regarding the arguments part. When I originally submitted this PR, I was under the impression this only affected the print for arguments to a function, but actually, it affects anything that uses a copy. This is preferable anyway with regard to consistency. The PR is about making ```copy``` explicit.
2024-08-18Bless *all* the mir-opt testsScott McMurray-179/+179
2024-08-18Update mir-opt filechecksScott McMurray-19/+19
2024-08-18stabilize raw_ref_opRalf Jung-1/+0
2024-07-31Do not normalize constants eagerly.Camille GILLOT-25/+13
2024-07-29Stabilize offset_of_nestedGeorge Bateman-1/+1
2024-07-29Perform instsimplify before inline to eliminate some trivial callsDianQK-1/+1
2024-07-17Split part of `adt_const_params` into `unsized_const_params`Boxy-1/+1
2024-06-26Bless mir-opt for excluded alloc bytesJosh Stone-66/+32
2024-06-26Use `-Zdump-mir-exclude-alloc-bytes` in some mir-opt testsJosh Stone-3/+8
2024-06-03rustfmt `tests/mir-opt`.Nicholas Nethercote-11/+16
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-17Remove `Rvalue::CheckedBinaryOp`Scott McMurray-8/+8
2024-04-28Update mir-opt tests, add proper regression testGeorge Bateman-318/+104
2024-04-24Fix tests and blessGary Guo-1/+0
2024-04-20mir-opt tests: rename unit-test -> test-mir-passRalf Jung-41/+41
2024-04-18At debuginfo=0, don't inline debuginfo when inliningScott McMurray-4/+0
2024-04-03rename `expose_addr` to `expose_provenance`joboet-6/+6
2024-04-03Remove MIR unsafe checkMatthew Jasper-84/+14
This also remove safety information from MIR.
2024-03-23rename MIR int2ptr casts to match library nameRalf Jung-2/+2
2024-03-10MIR printing: print the path of uneval'd const; refer to promoteds in a ↵Ralf Jung-19/+19
consistent way
2024-02-22[AUTO_GENERATED] Migrate compiletest to use `ui_test`-style `//@` directives许杰友 Jieyou Xu (Joe)-54/+54
2024-02-09Compute unsizing casts in GVN.Camille GILLOT-20/+22
2024-01-19Remove feature(offset_of) from testsGeorge Bateman-1/+1
2024-01-16Simplify Len.Camille GILLOT-36/+48
2024-01-16Simplify binary ops.Camille GILLOT-19/+25
2024-01-07Avoid recording no-op replacements.Camille GILLOT-92/+46
2024-01-07Do not re-simplify SSA locals.Camille GILLOT-12/+6
2023-12-24Replace legacy ConstProp by GVN.Camille GILLOT-572/+675
2023-12-02FileCheck while_let_loops.Camille GILLOT-1/+2
2023-12-02FileCheck tuple_literal_propagation.Camille GILLOT-2/+3
2023-12-02FileCheck return_place.Camille GILLOT-1/+2
2023-12-02FileCheck switch_int.Camille GILLOT-1/+8
2023-12-02FileCheck slice_len.Camille GILLOT-7/+22
2023-12-02FileCheck scalar_literal_propagation.Camille GILLOT-1/+3
2023-12-02FileCheck repeat.Camille GILLOT-1/+3