Skip to content

MIR move elimination [5/6]: Storage reconstruction - #163339

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
Amanieu:move-elimination/storage-reconstruction
Nov 1, 2026
Merged

rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
Amanieu:move-elimination/storage-reconstruction

Conversation

@Amanieu

@Amanieu Amanieu commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

View all comments

Depends on #163338

This PR extends the MoveElimination pass from rust-lang/rfcs#3943 to reconstruct StorageLive/StorageDead statements for all locals by using the liveness information collected by PreciseLiveness.

r? tmiasko

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 25, 2026
@Amanieu

Amanieu commented Sep 25, 2026 •

Copy link
Copy Markdown
Member Author

LLM disclosure: LLMs were used to generate the boilerplate for the MIR tests, but each test was manually reviewed and adjusted before committing. LLMs were also used to audit this pass against the rest of the compiler MIR transforms and Miri semantics.

@Amanieu Amanieu added the llm-assisted An LLM-assisted PR as defined by the LLM policy. Requires ahead-of-time consent by assignee. label Sep 25, 2026
@Amanieu
Amanieu force-pushed the move-elimination/storage-reconstruction branch from 6745385 to 96e6975 Compare September 26, 2026 01:05
@Amanieu
Amanieu force-pushed the move-elimination/storage-reconstruction branch from 96e6975 to 7736978 Compare September 30, 2026 12:49
@rust-log-analyzer

This comment has been minimized.

@Amanieu
Amanieu force-pushed the move-elimination/storage-reconstruction branch from 7736978 to eab2d36 Compare September 30, 2026 13:03
@Amanieu
Amanieu force-pushed the move-elimination/storage-reconstruction branch from eab2d36 to 53be078 Compare October 8, 2026 23:26
@rust-log-analyzer

This comment has been minimized.

@Amanieu
Amanieu force-pushed the move-elimination/storage-reconstruction branch from 53be078 to 579316a Compare October 9, 2026 11:11
@rustbot rustbot added the A-attributes Area: Attributes (`#[…]`, `#![…]`) label Oct 9, 2026
@Amanieu
Amanieu force-pushed the move-elimination/storage-reconstruction branch from 579316a to 6256aaa Compare October 10, 2026 17:58
@Amanieu
Amanieu force-pushed the move-elimination/storage-reconstruction branch from 4d906d5 to 07bdf02 Compare October 19, 2026 20:54
@rust-log-analyzer

This comment has been minimized.

@Amanieu
Amanieu force-pushed the move-elimination/storage-reconstruction branch from 07bdf02 to 74b0f10 Compare October 20, 2026 07:53
@Amanieu
Amanieu force-pushed the move-elimination/storage-reconstruction branch from 74b0f10 to 3f8e6da Compare October 21, 2026 15:32
@Amanieu
Amanieu marked this pull request as ready for review October 21, 2026 15:32
@rustbot

rustbot commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 21, 2026
@dianqk

dianqk commented Oct 22, 2026

Copy link
Copy Markdown
Member

I think this is a bit similar to #142531. I don't actually see any mir-opt pass that uses storage's UB in the real world. Should we have a dedicated StorageReconstruction pass placed later in the pipeline?
When using a local at a new location, we just remove the storage marks. StorageReconstruction will bring them back.
I think this should benefit other passes, such as Inline.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 28, 2026
@tmiasko

tmiasko commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

@bors r+

@rust-bors

rust-bors Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

📌 Commit fd0bab6 has been approved by tmiasko

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 29, 2026
@Amanieu
Amanieu force-pushed the move-elimination/storage-reconstruction branch from fd0bab6 to 0827b4d Compare October 29, 2026 20:24
@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 29, 2026
@rust-bors

rust-bors Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

⚠️ A new commit 0827b4d71504bc9844a2c8c6dd2af4816857e6c4 was pushed.

This pull request was unapproved.

@Amanieu

Amanieu commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Collapsed the commits

@bors r= tmiasko

@rust-bors

rust-bors Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Unknown value for argument "r". Run @bors help or go to https://bors.rust-lang.org/help to see available commands.

@Amanieu

Amanieu commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

@bors r=tmiasko

@rust-bors

rust-bors Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 0827b4d has been tentatively approved by tmiasko

It will be put into the queue for this repository once PR CI succeeds.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 29, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Member

@bors rollup=iffy
Making a rollup of perf sensitive prs

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 30, 2026
…econstruction, r=tmiasko

MIR move elimination [5/6]: Storage reconstruction

Depends on rust-lang#163338

This PR extends the `MoveElimination` pass from rust-lang/rfcs#3943 to reconstruct `StorageLive`/`StorageDead` statements for all locals by using the liveness information collected by `PreciseLiveness`.

r? tmiasko
@Amanieu

Amanieu commented Oct 30, 2026

Copy link
Copy Markdown
Member Author

This one has no perf impact, the optimization is disabled by default.

@JonathanBrouwer

Copy link
Copy Markdown
Member

Ah I see, thanks!
Well it's in the perf rollup now so I'll just let it be :)

rust-bors Bot pushed a commit that referenced this pull request Oct 30, 2026
…uwer

Rollup of 7 perf-sensitive pull requests

Successful merges:

 - #163339 (MIR move elimination [5/6]: Storage reconstruction)
 - #163525 (Move lang item collection to the resolver)
 - #163928 (do not prefer trivially true candidates with `-Znext-solver` )
 - #164341 (Expand an early return case in `coerce_unsized`)
 - #164484 (Use adaptive sparse encoding for metadata tables)
 - #164607 (destringlyfy lint infrastructure)
 - #165160 (New solver opts for diesel (part 3))

> [!WARNING]
> This rollup conflicts with pending auto build #165178 and may need to be recreated if the pending build succeeds.
rust-bors Bot pushed a commit that referenced this pull request Oct 31, 2026
…uwer

Rollup of 7 perf-sensitive pull requests

Successful merges:

 - #163339 (MIR move elimination [5/6]: Storage reconstruction)
 - #163525 (Move lang item collection to the resolver)
 - #163928 (do not prefer trivially true candidates with `-Znext-solver` )
 - #164341 (Expand an early return case in `coerce_unsized`)
 - #164484 (Use adaptive sparse encoding for metadata tables)
 - #164607 (destringlyfy lint infrastructure)
 - #165160 (New solver opts for diesel (part 3))

> [!WARNING]
> This rollup conflicts with pending auto build #165178 and may need to be recreated if the pending build succeeds.
rust-bors Bot pushed a commit that referenced this pull request Oct 31, 2026
…uwer

Rollup of 7 perf-sensitive pull requests

Successful merges:

 - #163339 (MIR move elimination [5/6]: Storage reconstruction)
 - #163525 (Move lang item collection to the resolver)
 - #163928 (do not prefer trivially true candidates with `-Znext-solver` )
 - #164341 (Expand an early return case in `coerce_unsized`)
 - #164484 (Use adaptive sparse encoding for metadata tables)
 - #164607 (destringlyfy lint infrastructure)
 - #165160 (New solver opts for diesel (part 3))

> [!WARNING]
> This rollup conflicts with pending auto build #165178 and may need to be recreated if the pending build succeeds.
rust-bors Bot pushed a commit that referenced this pull request Oct 31, 2026
…uwer

Rollup of 7 perf-sensitive pull requests

Successful merges:

 - #163339 (MIR move elimination [5/6]: Storage reconstruction)
 - #163359 (MIR move elimination [1.5/6]: Ensure ZSTs are always initialized)
 - #163525 (Move lang item collection to the resolver)
 - #163928 (do not prefer trivially true candidates with `-Znext-solver` )
 - #164341 (Expand an early return case in `coerce_unsized`)
 - #164484 (Use adaptive sparse encoding for metadata tables)
 - #164607 (destringlyfy lint infrastructure)
@rust-bors
rust-bors Bot merged commit 6a099dc into rust-lang:main Nov 1, 2026
14 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Nov 1, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 1, 2026
Rollup merge of #163339 - Amanieu:move-elimination/storage-reconstruction, r=tmiasko

MIR move elimination [5/6]: Storage reconstruction

Depends on #163338

This PR extends the `MoveElimination` pass from rust-lang/rfcs#3943 to reconstruct `StorageLive`/`StorageDead` statements for all locals by using the liveness information collected by `PreciseLiveness`.

r? tmiasko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) llm-assisted An LLM-assisted PR as defined by the LLM policy. Requires ahead-of-time consent by assignee. perf-regression Performance regression. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants