<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff, branch try-perf</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=try-perf</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=try-perf'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2025-07-23T23:54:37+00:00</updated>
<entry>
<title>Give an AllocId to ConstValue::Slice.</title>
<updated>2025-07-23T23:54:37+00:00</updated>
<author>
<name>Camille GILLOT</name>
<email>gillot.camille@gmail.com</email>
</author>
<published>2023-10-13T20:20:57+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=9ff071219bca913e45235568defadd5ab840c50a'/>
<id>urn:sha1:9ff071219bca913e45235568defadd5ab840c50a</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Revert "comment out the old tests instead of adjusting them"</title>
<updated>2025-04-02T11:59:26+00:00</updated>
<author>
<name>dianqk</name>
<email>dianqk@dianqk.net</email>
</author>
<published>2025-03-24T08:55:24+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=7e0463fe93b7fec40e564fb1312296ed608ce837'/>
<id>urn:sha1:7e0463fe93b7fec40e564fb1312296ed608ce837</id>
<content type='text'>
This reverts commit 906f66fb4c22daa8a6f97e5c048e9f6ab3fd9051.
</content>
</entry>
<entry>
<title>comment out the old tests instead of adjusting them</title>
<updated>2024-11-25T19:39:45+00:00</updated>
<author>
<name>Ralf Jung</name>
<email>post@ralfj.de</email>
</author>
<published>2024-11-25T19:38:57+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=906f66fb4c22daa8a6f97e5c048e9f6ab3fd9051'/>
<id>urn:sha1:906f66fb4c22daa8a6f97e5c048e9f6ab3fd9051</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Do not unify dereferences in GVN.</title>
<updated>2024-11-25T19:19:08+00:00</updated>
<author>
<name>Camille GILLOT</name>
<email>gillot.camille@gmail.com</email>
</author>
<published>2024-11-01T14:32:09+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=917dd826286bd85e26310e4db4a125d4038c277e'/>
<id>urn:sha1:917dd826286bd85e26310e4db4a125d4038c277e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>be even more precise about "cast" vs "coercion"</title>
<updated>2024-09-24T21:12:02+00:00</updated>
<author>
<name>Lukas Markeffsky</name>
<email>@</email>
</author>
<published>2024-09-15T17:35:06+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=bd31e3ed70b75e5936880b18f6b5d1c8f5ee344f'/>
<id>urn:sha1:bd31e3ed70b75e5936880b18f6b5d1c8f5ee344f</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Auto merge of #122551 - RayMuir:copy_fmt, r=saethlin</title>
<updated>2024-08-19T23:10:46+00:00</updated>
<author>
<name>bors</name>
<email>bors@rust-lang.org</email>
</author>
<published>2024-08-19T23:10:46+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=79611d90b6b3fc6f17a0b07ba228b28e89de16e3'/>
<id>urn:sha1:79611d90b6b3fc6f17a0b07ba228b28e89de16e3</id>
<content type='text'>
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) -&gt; () {
    debug foo =&gt; _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 =&gt; _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) -&gt; [0: bb2, otherwise: bb1];
    }

    bb1: {
        StorageDead(_4);
        StorageLive(_5);
        _5 = copy _1;
        StorageDead(_5);
        _0 = const ();
        goto -&gt; bb3;
    }

    bb2: {
        StorageDead(_4);
        StorageLive(_6);
        _6 = copy _2;
        StorageDead(_6);
        _0 = const ();
        goto -&gt; 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.
</content>
</entry>
<entry>
<title>Bless *all* the mir-opt tests</title>
<updated>2024-08-18T23:07:33+00:00</updated>
<author>
<name>Scott McMurray</name>
<email>scottmcm@users.noreply.github.com</email>
</author>
<published>2024-08-18T21:26:34+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=99cb0c6bc399fb94a0ddde7e9b38e9c00d523bad'/>
<id>urn:sha1:99cb0c6bc399fb94a0ddde7e9b38e9c00d523bad</id>
<content type='text'>
</content>
</entry>
<entry>
<title>stabilize raw_ref_op</title>
<updated>2024-08-18T17:46:53+00:00</updated>
<author>
<name>Ralf Jung</name>
<email>post@ralfj.de</email>
</author>
<published>2024-07-13T11:53:56+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=79503dd742253cdca54f10aec9052ff477ccaf38'/>
<id>urn:sha1:79503dd742253cdca54f10aec9052ff477ccaf38</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Bless mir-opt for excluded alloc bytes</title>
<updated>2024-06-26T22:30:47+00:00</updated>
<author>
<name>Josh Stone</name>
<email>jistone@redhat.com</email>
</author>
<published>2024-06-14T23:05:22+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=7c3673ff6f2ff4e8e85344c091c9feb4b5da1290'/>
<id>urn:sha1:7c3673ff6f2ff4e8e85344c091c9feb4b5da1290</id>
<content type='text'>
</content>
</entry>
<entry>
<title>More GVN for PtrMetadata</title>
<updated>2024-06-21T05:16:59+00:00</updated>
<author>
<name>Scott McMurray</name>
<email>scottmcm@users.noreply.github.com</email>
</author>
<published>2024-06-20T05:14:31+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=4a7b6c0e6ce760964284d50705eefdc8dea7d0c3'/>
<id>urn:sha1:4a7b6c0e6ce760964284d50705eefdc8dea7d0c3</id>
<content type='text'>
`PtrMetadata` doesn't care about `*const`/`*mut`/`&amp;`/`&amp;mut`, so GVN away those casts in its argument.

This includes updating MIR to allow calling PtrMetadata on references too, not just raw pointers.  That means that `[T]::len` can be just `_0 = PtrMetadata(_1)`, for example.

# Conflicts:
#	tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir
#	tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir
</content>
</entry>
</feed>
