Skip to content

Reuse CTFE MIR for constructors.#156053

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
cjgillot:optimized-reuse-ctfe
May 2, 2026
Merged

Reuse CTFE MIR for constructors.#156053
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
cjgillot:optimized-reuse-ctfe

Conversation

@cjgillot
Copy link
Copy Markdown
Contributor

@cjgillot cjgillot commented May 1, 2026

For constructors, we manually build the MIR shim we want. We can just have optimized_mir call mir_for_ctfe instead of rebuilding the shim.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 1, 2026
@cjgillot
Copy link
Copy Markdown
Contributor Author

cjgillot commented May 1, 2026

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 1, 2026
rust-bors Bot pushed a commit that referenced this pull request May 1, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 1, 2026

☀️ Try build successful (CI)
Build commit: fdbcb89 (fdbcb89c7a517735d4a70cc4cb279493bb22e249, parent: 0469a92a76c327df972cb6c1356934b7a0c6b86d)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (fdbcb89): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This perf run didn't have relevant results for this metric.

Max RSS (memory usage)

Results (secondary -1.8%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.8% [-1.8%, -1.8%] 1
All ❌✅ (primary) - - 0

Cycles

Results (secondary 1.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
4.4% [4.4%, 4.4%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.2% [-2.2%, -2.2%] 1
All ❌✅ (primary) - - 0

Binary size

Results (primary 0.0%, secondary 0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.0% [0.0%, 0.0%] 7
Regressions ❌
(secondary)
0.1% [0.1%, 0.1%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.0% [0.0%, 0.0%] 7

Bootstrap: 481.713s -> 484.465s (0.57%)
Artifact size: 390.96 MiB -> 390.95 MiB (-0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 1, 2026
@cjgillot cjgillot marked this pull request as ready for review May 1, 2026 20:10
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 1, 2026

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 May 1, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 1, 2026

r? @jackh726

rustbot has assigned @jackh726.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler, mir, mir-opt
  • compiler, mir, mir-opt expanded to 73 candidates
  • Random selection from 21 candidates

Copy link
Copy Markdown
Contributor

@oli-obk oli-obk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 2, 2026

📌 Commit b14a811 has been approved by oli-obk

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 May 2, 2026
rust-bors Bot pushed a commit that referenced this pull request May 2, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #156030 (Make stable hashing names consistent (part 1))
 - #156020 (Improve source code for `librustdoc/visit_ast.rs`)
 - #156021 (Clean up some traits)
 - #156028 (Add a `Local::arg(i)` helper constructor)
 - #156037 (Add AcceptContext::expect_no_args)
 - #156040 (Add missing alias to mailmap)
 - #156048 (Make `diverging_type_vars` a vec of `TyVid`)
 - #156053 (Reuse CTFE MIR for constructors.)
 - #156059 (compiler: Print valid `-Zmir-enable-passes` names if invalid name is used)

Failed merges:

 - #155940 (refactor rustc_on_unimplemented's filtering)
 - #156065 (Remove unused spans from AttributeKind)
@rust-bors rust-bors Bot merged commit 3903d94 into rust-lang:main May 2, 2026
12 checks passed
@rustbot rustbot added this to the 1.97.0 milestone May 2, 2026
rust-timer added a commit that referenced this pull request May 2, 2026
Rollup merge of #156053 - cjgillot:optimized-reuse-ctfe, r=oli-obk

Reuse CTFE MIR for constructors.

For constructors, we manually build the MIR shim we want. We can just have `optimized_mir` call `mir_for_ctfe` instead of rebuilding the shim.
@cjgillot cjgillot deleted the optimized-reuse-ctfe branch May 2, 2026 15:02
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request May 4, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#156030 (Make stable hashing names consistent (part 1))
 - rust-lang/rust#156020 (Improve source code for `librustdoc/visit_ast.rs`)
 - rust-lang/rust#156021 (Clean up some traits)
 - rust-lang/rust#156028 (Add a `Local::arg(i)` helper constructor)
 - rust-lang/rust#156037 (Add AcceptContext::expect_no_args)
 - rust-lang/rust#156040 (Add missing alias to mailmap)
 - rust-lang/rust#156048 (Make `diverging_type_vars` a vec of `TyVid`)
 - rust-lang/rust#156053 (Reuse CTFE MIR for constructors.)
 - rust-lang/rust#156059 (compiler: Print valid `-Zmir-enable-passes` names if invalid name is used)

Failed merges:

 - rust-lang/rust#155940 (refactor rustc_on_unimplemented's filtering)
 - rust-lang/rust#156065 (Remove unused spans from AttributeKind)
pull Bot pushed a commit to Kokoro2336/rust-analyzer that referenced this pull request May 4, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#156030 (Make stable hashing names consistent (part 1))
 - rust-lang/rust#156020 (Improve source code for `librustdoc/visit_ast.rs`)
 - rust-lang/rust#156021 (Clean up some traits)
 - rust-lang/rust#156028 (Add a `Local::arg(i)` helper constructor)
 - rust-lang/rust#156037 (Add AcceptContext::expect_no_args)
 - rust-lang/rust#156040 (Add missing alias to mailmap)
 - rust-lang/rust#156048 (Make `diverging_type_vars` a vec of `TyVid`)
 - rust-lang/rust#156053 (Reuse CTFE MIR for constructors.)
 - rust-lang/rust#156059 (compiler: Print valid `-Zmir-enable-passes` names if invalid name is used)

Failed merges:

 - rust-lang/rust#155940 (refactor rustc_on_unimplemented's filtering)
 - rust-lang/rust#156065 (Remove unused spans from AttributeKind)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants