Skip to content

Add post-mono MIR optimizations #131650

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

saethlin
Copy link
Member

@saethlin saethlin commented Oct 13, 2024

Before this PR, all MIR passes had to operate on polymorphic MIR. Thus any MIR transform maybe unable to determine the type of an argument or local (because it's still generic) or it may be unable to determine which function a Call terminator is calling (because it's still generic).

MIR transforms are a highly maintainable solution to a number of compiler problems, but this polymorphic limitation means that they are cannot solve some of our problems that we'd like them to; the most recent examples that come to mind are #134082 which has extra limitations because of the polymorphic inliner, and #139088 which is explicitly waiting for post-mono MIR passes to happen.

In addition, the lack of post-mono MIR optimizations means that MIR optimizations just miss out on profitable optimizations, which are so valuable that we've added kludges like #121421 (a MIR traversal that you better only run at mono-time).

In addition, rustc_codegen_ssa is riddled with on-the-fly monomorphization and optimization; the logic for these trick that we do in codegen in my experience are hard to maintain, and I would much rather have those implemented in a MIR transform.

So this PR adds a new query codegen_mir (the MIR for codegen, not that I like the name). I've then replaced some of the kludges in rustc_codegen_ssa with PostMono variants of existing MIR transforms.

I've also un-querified check_mono_item and put it at the end of the post-mono pass list. Those checks should be post-mono passes too, but I've tried to keep this PR to a reviewable size. It's easy to imagine lots of other places to use post-mono MIR opts and I want the usefulness of this to be clear while the diff is also manageable.


This PR has a perf regression. I've hammered on the perf in a number of ways to get it down to what it is. incr-full builds suffer the most because they need to clone, intern, and cache a monomorphized copy of every MIR body. Things are mixed for every other build scenario. In almost all cases, binary sizes improve.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 13, 2024
@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added the PG-exploit-mitigations Project group: Exploit mitigations label Oct 13, 2024
@rust-log-analyzer

This comment has been minimized.

@saethlin
Copy link
Member Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 13, 2024
@bors
Copy link
Collaborator

bors commented Oct 13, 2024

⌛ Trying commit a211812 with merge b141564...

bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 13, 2024
Add post-mono MIR passes to make mono-reachable analysis more accurate

r? ghost
@bors
Copy link
Collaborator

bors commented Oct 13, 2024

☀️ Try build successful - checks-actions
Build commit: b141564 (b1415647cdfcdd1b8dc5ed5f9a5aba87ade0b225)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (b141564): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
12.2% [0.2%, 93.7%] 163
Regressions ❌
(secondary)
6.9% [0.2%, 266.3%] 119
Improvements ✅
(primary)
-0.7% [-3.0%, -0.2%] 6
Improvements ✅
(secondary)
-11.1% [-33.8%, -0.2%] 12
All ❌✅ (primary) 11.7% [-3.0%, 93.7%] 169

Max RSS (memory usage)

Results (primary 14.5%, secondary 1.7%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
14.5% [0.7%, 56.9%] 108
Regressions ❌
(secondary)
4.5% [0.6%, 12.8%] 34
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-22.2% [-24.2%, -19.2%] 4
All ❌✅ (primary) 14.5% [0.7%, 56.9%] 108

Cycles

Results (primary 22.8%, secondary 13.8%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
23.0% [0.8%, 108.5%] 111
Regressions ❌
(secondary)
19.4% [1.0%, 223.4%] 42
Improvements ✅
(primary)
-3.0% [-3.0%, -3.0%] 1
Improvements ✅
(secondary)
-33.2% [-42.8%, -1.3%] 5
All ❌✅ (primary) 22.8% [-3.0%, 108.5%] 112

Binary size

Results (primary -0.3%, secondary -2.3%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.8% [0.0%, 2.3%] 7
Regressions ❌
(secondary)
0.1% [0.1%, 0.1%] 1
Improvements ✅
(primary)
-0.4% [-1.7%, -0.0%] 76
Improvements ✅
(secondary)
-2.4% [-25.8%, -0.0%] 65
All ❌✅ (primary) -0.3% [-1.7%, 2.3%] 83

Bootstrap: 781.427s -> 807.023s (3.28%)
Artifact size: 331.96 MiB -> 332.21 MiB (0.08%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Oct 13, 2024
@saethlin
Copy link
Member Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 14, 2024
@bors
Copy link
Collaborator

bors commented Oct 14, 2024

⌛ Trying commit 6f6737a with merge 9233d9f...

bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 14, 2024
Add post-mono MIR passes to make mono-reachable analysis more accurate

r? ghost
@bors
Copy link
Collaborator

bors commented Oct 14, 2024

☀️ Try build successful - checks-actions
Build commit: 9233d9f (9233d9f83ca672be3b2cfa697806fdb7c8970490)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (9233d9f): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
7.6% [0.1%, 59.9%] 151
Regressions ❌
(secondary)
2.9% [0.2%, 18.7%] 107
Improvements ✅
(primary)
-3.0% [-3.0%, -3.0%] 1
Improvements ✅
(secondary)
-6.6% [-64.0%, -0.3%] 11
All ❌✅ (primary) 7.5% [-3.0%, 59.9%] 152

Max RSS (memory usage)

Results (primary 11.3%, secondary 2.4%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
12.9% [1.3%, 52.1%] 93
Regressions ❌
(secondary)
3.6% [2.2%, 5.9%] 10
Improvements ✅
(primary)
-2.7% [-4.3%, -0.8%] 10
Improvements ✅
(secondary)
-3.4% [-3.5%, -3.4%] 2
All ❌✅ (primary) 11.3% [-4.3%, 52.1%] 103

Cycles

Results (primary 10.6%, secondary 3.2%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
10.7% [1.0%, 50.1%] 94
Regressions ❌
(secondary)
5.4% [1.7%, 18.4%] 37
Improvements ✅
(primary)
-3.1% [-3.1%, -3.1%] 1
Improvements ✅
(secondary)
-17.2% [-62.3%, -1.6%] 4
All ❌✅ (primary) 10.6% [-3.1%, 50.1%] 95

Binary size

Results (primary -0.1%, secondary -0.3%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.7% [0.0%, 2.4%] 9
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.2% [-0.8%, -0.0%] 69
Improvements ✅
(secondary)
-0.3% [-0.8%, -0.0%] 51
All ❌✅ (primary) -0.1% [-0.8%, 2.4%] 78

Bootstrap: 782.104s -> 806.252s (3.09%)
Artifact size: 332.57 MiB -> 332.81 MiB (0.07%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 14, 2024
@saethlin
Copy link
Member Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 24, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 24, 2024
Add post-mono MIR passes to make mono-reachable analysis more accurate

As of rust-lang#131650 (comment) I believe most of the incr overhead comes from re-computing, re-encoding, and loading a lot more MIR when all we're actually doing is traversing through it. I think that can be addressed by caching a query that looks up the mentioned/used items for an Instance.

I think the full-build regressions are pretty much just the expense of cloning, then monomorphizing, then caching the MIR.
@bors
Copy link
Collaborator

bors commented Oct 24, 2024

⌛ Trying commit 4ae3542 with merge 174810c...

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (10fa210): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
0.8% [0.2%, 3.9%] 135
Regressions ❌
(secondary)
1.1% [0.1%, 19.6%] 78
Improvements ✅
(primary)
-0.9% [-1.6%, -0.3%] 4
Improvements ✅
(secondary)
-1.0% [-2.8%, -0.3%] 5
All ❌✅ (primary) 0.8% [-1.6%, 3.9%] 139

Max RSS (memory usage)

Results (primary 8.4%, secondary 3.1%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
8.7% [0.5%, 31.2%] 58
Regressions ❌
(secondary)
3.1% [2.8%, 3.6%] 3
Improvements ✅
(primary)
-0.8% [-1.1%, -0.5%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 8.4% [-1.1%, 31.2%] 60

Cycles

Results (primary 2.2%, secondary 3.7%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.2% [0.4%, 4.7%] 43
Regressions ❌
(secondary)
4.3% [1.1%, 18.4%] 9
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.7% [-1.7%, -1.7%] 1
All ❌✅ (primary) 2.2% [0.4%, 4.7%] 43

Binary size

Results (primary -0.4%, secondary -0.3%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.4% [0.1%, 1.2%] 4
Regressions ❌
(secondary)
0.1% [0.1%, 0.1%] 1
Improvements ✅
(primary)
-0.4% [-1.3%, -0.0%] 91
Improvements ✅
(secondary)
-0.3% [-0.8%, -0.0%] 57
All ❌✅ (primary) -0.4% [-1.3%, 1.2%] 95

Bootstrap: 776.211s -> 784.617s (1.08%)
Artifact size: 365.21 MiB -> 364.79 MiB (-0.12%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 26, 2025
lnicola pushed a commit to lnicola/rust-analyzer that referenced this pull request Apr 28, 2025
…tsakis

Ergonomic ref counting: optimize away clones when possible

This PR build on top of rust-lang/rust#134797. It optimizes codegen of ergonomic ref-counting when the type being `use`d is only known to be copy after monomorphization. We avoid codening a clone and generate bitwise copy instead.

RFC: rust-lang/rfcs#3680
Tracking issue: rust-lang/rust#132290
Project goal: rust-lang/rust-project-goals#107

r? `@nikomatsakis`

This PR could better sit on top of rust-lang/rust#131650 but as it did not land yet I've decided to just do minimal changes. It may be the case that doing what I'm doing regress the performance and we may need to go the full route of rust-lang/rust#131650.
cc `@saethlin` in this regard.
debug!("monomorphize: self.instance={:?}", self.instance);
self.instance.instantiate_mir_and_normalize_erasing_regions(
self.cx.tcx(),
self.cx.typing_env(),
ty::EarlyBinder::bind(value),
)
value
Copy link
Contributor

Choose a reason for hiding this comment

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

Uh I guess remove this function in a follow-up? 😆

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah. Leaving this stub in is part of me trying to keep the diff reviewable.

Comment on lines 645 to 648
query build_codegen_mir(key: ty::Instance<'tcx>) -> &'tcx mir::Body<'tcx> {
desc { |tcx| "finalizing codegen MIR for `{}`", tcx.def_path_str_with_args(key.def_id(), key.args) }
arena_cache
}
Copy link
Contributor

Choose a reason for hiding this comment

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

one thing you can try to improve compile times here is no_hash. Since we are not storing it in the incremental caches anyway, we need to recompute it always as the only callers are from codegen, which either gets loaded from cache, so we don't need to call this one, or it doesn't get loaded from cache, then we can just reevaluate it. I think eval_always would make perf worse again, as we'd rerun it even if it's not needed?

@oli-obk
Copy link
Contributor

oli-obk commented Apr 28, 2025

Some of the perf regressions show about twice as many build_codegen_mir invocations as optimized_mir invocations. Could it make sense to run everything from build_codegen_mir in optimized_mir for already monomorphic bodies? And then have build_codegen_mir just forward that body (without even re-arena-allocating the body)?

@saethlin
Copy link
Member Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

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

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 29, 2025
@bors
Copy link
Collaborator

bors commented Apr 29, 2025

🔒 Merge conflict

This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again.

How do I rebase?

Assuming self is your fork and upstream is this repository, you can resolve the conflict following these steps:

  1. git checkout post-mono-mir-opts (switch to your branch)
  2. git fetch upstream master (retrieve the latest master)
  3. git rebase upstream/master -p (rebase on top of it)
  4. Follow the on-screen instruction to resolve conflicts (check git status if you got lost).
  5. git push self post-mono-mir-opts --force-with-lease (update this PR)

You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial.

Please avoid the "Resolve conflicts" button on GitHub. It uses git merge instead of git rebase which makes the PR commit history more difficult to read.

Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Cargo.lock conflict is handled during merge and rebase. This is normal, and you should still perform step 5 to update this PR.

Error message
Removing tests/ui/mir/validate/critical-edge.rs
Removing tests/codegen/skip-mono-inside-if-false.rs
Auto-merging compiler/rustc_monomorphize/src/collector.rs
Auto-merging compiler/rustc_mir_transform/src/validate.rs
Auto-merging compiler/rustc_mir_transform/src/lib.rs
CONFLICT (content): Merge conflict in compiler/rustc_mir_transform/src/lib.rs
Auto-merging compiler/rustc_middle/src/ty/mod.rs
Auto-merging compiler/rustc_middle/src/query/mod.rs
Auto-merging compiler/rustc_middle/src/mir/mod.rs
Auto-merging compiler/rustc_codegen_ssa/src/mir/block.rs
Auto-merging compiler/rustc_codegen_cranelift/src/base.rs
Auto-merging Cargo.lock
Automatic merge failed; fix conflicts and then commit the result.

@saethlin saethlin force-pushed the post-mono-mir-opts branch from cdeca91 to fd7dfb6 Compare April 29, 2025 00:50
@rust-log-analyzer

This comment has been minimized.

@saethlin
Copy link
Member Author

Could it make sense to run everything from build_codegen_mir in optimized_mir for already monomorphic bodies? And then have build_codegen_mir just forward that body (without even re-arena-allocating the body)?

I got most of the way through implementing this before I realized that it's not this easy.

One of the special powers that post-mono GVN and InstSimplify get is to always evaluate the UbChecks intrinsic and do simplifications based on that. If we run those post-mono passes as part of optimized_mir, we'd strip the UB check out of hint::unreachable_unchecked.

I'm still curious to benchmark this because maybe there's some kind of angle where we check is_polymorphic || contains_ub_check

@bors
Copy link
Collaborator

bors commented Apr 30, 2025

☔ The latest upstream changes (presumably #139720) made this pull request unmergeable. Please resolve the merge conflicts.

@saethlin saethlin force-pushed the post-mono-mir-opts branch from 4298535 to 56689e1 Compare April 30, 2025 23:29
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@saethlin
Copy link
Member Author

saethlin commented May 1, 2025

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

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

@bors
Copy link
Collaborator

bors commented May 1, 2025

⌛ Trying commit 8ac6827 with merge 8c46fcbb191b4a054f15dac8d411078faa679379...

bors added a commit to rust-lang-ci/rust that referenced this pull request May 1, 2025
Add post-mono MIR optimizations

Before this PR, all MIR passes had to operate on polymorphic MIR. Thus any MIR transform maybe unable to determine the type of an argument or local (because it's still generic) or it may be unable to determine which function a Call terminator is calling (because it's still generic).

MIR transforms are a highly maintainable solution to a number of compiler problems, but this polymorphic limitation means that they are cannot solve some of our problems that we'd like them to; the most recent examples that come to mind are rust-lang#134082 which has extra limitations because of the polymorphic inliner, and rust-lang#139088 which is explicitly waiting for post-mono MIR passes to happen.

In addition, the lack of post-mono MIR optimizations means that MIR optimizations just miss out on profitable optimizations, which are so valuable that we've added kludges like rust-lang#121421 (a MIR traversal that you better only run at mono-time).

In addition, rustc_codegen_ssa is riddled with on-the-fly monomorphization and optimization; the logic for these trick that we do in codegen in my experience are hard to maintain, and I would much rather have those implemented in a MIR transform.

So this PR adds a new query `codegen_mir` (the MIR for codegen, not that I like the name). I've then replaced _some_ of the kludges in rustc_codegen_ssa with `PostMono` variants of existing MIR transforms.

I've also un-querified `check_mono_item` and put it at the end of the post-mono pass list. Those checks should be post-mono passes too, but I've tried to keep this PR to a reviewable size. It's easy to imagine lots of other places to use post-mono MIR opts and I want the usefulness of this to be clear while the diff is also manageable.

---

This PR has a perf regression. I've hammered on the perf in a number of ways to get it down to what it is. incr-full builds suffer the most because they need to clone, intern, and cache a monomorphized copy of every MIR body. Things are mixed for every other build scenario. In almost all cases, binary sizes improve.
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-19 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#18 exporting to docker image format
#18 sending tarball 20.0s done
#18 DONE 23.0s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-19]
[CI_JOB_NAME=x86_64-gnu-llvm-19]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
sccache: Listening on address 127.0.0.1:4226
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-19', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'build.print-step-timings', '--enable-verbose-tests', '--set', 'build.metrics', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--set', 'gcc.download-ci-gcc=true', '--enable-new-symbol-mangling']
configure: build.build          := x86_64-unknown-linux-gnu
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-19/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
failures:

---- [mir-opt] tests/mir-opt/building/custom/unwind_terminate.rs stdout ----

error: verification with 'FileCheck' failed
status: exit status: 1
command: "/usr/lib/llvm-19/bin/FileCheck" "--input-file" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/building/custom/unwind_terminate/unwind_terminate.mir" "/checkout/tests/mir-opt/building/custom/unwind_terminate.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/checkout/tests/mir-opt/building/custom/unwind_terminate.rs:7:11: error: CHECK: expected string not found in input
// CHECK: bb1 (cleanup): {
          ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/building/custom/unwind_terminate/unwind_terminate.mir:4:7: note: scanning from here
fn f() -> () {
      ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/building/custom/unwind_terminate/unwind_terminate.mir:4:8: note: possible intended match here
fn f() -> () {
       ^
/checkout/tests/mir-opt/building/custom/unwind_terminate.rs:22:11: error: CHECK: expected string not found in input
// CHECK: bb1 (cleanup): {
          ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/building/custom/unwind_terminate/unwind_terminate.mir:12:7: note: scanning from here
fn g() -> () {
      ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/building/custom/unwind_terminate/unwind_terminate.mir:12:8: note: possible intended match here
fn g() -> () {
       ^

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/building/custom/unwind_terminate/unwind_terminate.mir
Check file: /checkout/tests/mir-opt/building/custom/unwind_terminate.rs

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: // WARNING: This output format is intended for human consumers only 
            2: // and is subject to change without notice. Knock yourself out. 
            3: // HINT: See also -Z dump-mir for MIR at specific points during compilation. 
            4: fn f() -> () { 
check:7'0            X~~~~~~~~ error: no match found
check:7'1             ?        possible intended match
            5:  let mut _0: (); 
check:7'0      ~~~~~~~~~~~~~~~~~
            6:  
check:7'0      ~
            7:  bb0: { 
check:7'0      ~~~~~~~~
            8:  return; 
check:7'0      ~~~~~~~~~
            9:  } 
check:7'0      ~~~
           10: } 
check:7'0      ~~
           11:  
check:7'0      ~
           12: fn g() -> () { 
check:7'0      ~~~~~~
check:22'0           X~~~~~~~~ error: no match found
check:22'1            ?        possible intended match
           13:  let mut _0: (); 
check:22'0     ~~~~~~~~~~~~~~~~~
           14:  
check:22'0     ~
           15:  bb0: { 
check:22'0     ~~~~~~~~
           16:  return; 
---
31           StorageLive(_5);
32           _5 = copy _1;
-           nop;
34 -         StorageLive(_14);
+           nop;
35 -         _14 = BitAnd(copy _5, const 255_u32);
- -         _4 = BitOr(const 0_u32, move _14);
- -         StorageDead(_14);
38 +         nop;
39 +         _14 = BitAnd(copy _1, const 255_u32);
- +         _4 = copy _14;
+           _4 = copy _14;
+ -         StorageDead(_14);
41 +         nop;
42           StorageDead(_5);
43           StorageLive(_6);


thread '[mir-opt] tests/mir-opt/issue_101973.rs' panicked at src/tools/compiletest/src/runtest/mir_opt.rs:84:21:
Actual MIR output differs from expected MIR output /checkout/tests/mir-opt/issue_101973.inner.GVN.panic-unwind.diff
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- [mir-opt] tests/mir-opt/optimize_none.rs#NO-OPT stdout ----

error in revision `NO-OPT`: verification with 'FileCheck' failed
status: exit status: 1
command: "/usr/lib/llvm-19/bin/FileCheck" "--input-file" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/optimize_none.NO-OPT/optimize_none.mir" "/checkout/tests/mir-opt/optimize_none.rs" "--check-prefix=CHECK" "--check-prefix" "NO-OPT" "--allow-unused-prefixes" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/checkout/tests/mir-opt/optimize_none.rs:10:12: error: CHECK: expected string not found in input
 // CHECK: AddWithOverflow(const 1_i32, const 2_i32);
           ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/optimize_none.NO-OPT/optimize_none.mir:4:14: note: scanning from here
fn add_noopt() -> i32 {
             ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/optimize_none.NO-OPT/optimize_none.mir:9:2: note: possible intended match here
 _1 = const (3_i32, false);
 ^
/checkout/tests/mir-opt/optimize_none.rs:18:12: error: CHECK: expected string not found in input
 // CHECK: switchInt(const true) -> [0: [[FALSE:bb[0-9]+]], otherwise: [[TRUE:bb[0-9]+]]];
           ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/optimize_none.NO-OPT/optimize_none.mir:19:17: note: scanning from here
fn const_branch() -> i32 {
                ^

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/optimize_none.NO-OPT/optimize_none.mir
Check file: /checkout/tests/mir-opt/optimize_none.rs

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: // WARNING: This output format is intended for human consumers only 
            2: // and is subject to change without notice. Knock yourself out. 
            3: // HINT: See also -Z dump-mir for MIR at specific points during compilation. 
            4: fn add_noopt() -> i32 { 
check:10'0                  X~~~~~~~~~~ error: no match found
            5:  let mut _0: i32; 
check:10'0     ~~~~~~~~~~~~~~~~~~
            6:  let mut _1: (i32, bool); 
check:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
            7:  
check:10'0     ~
            8:  bb0: { 
check:10'0     ~~~~~~~~
            9:  _1 = const (3_i32, false); 
check:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:10'1      ?                           possible intended match
           10:  _0 = const 3_i32; 
check:10'0     ~~~~~~~~~~~~~~~~~~~
           11:  return; 
check:10'0     ~~~~~~~~~
           12:  } 
check:10'0     ~~~
           13: } 
check:10'0     ~~
           14:  
check:10'0     ~
           15: alloc1 (size: 8, align: 4) { 
check:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           16:  03 00 00 00 00 __ __ __ │ .....░░░ 
check:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           17: } 
check:10'0     ~~
           18:  
check:10'0     ~
           19: fn const_branch() -> i32 { 
check:10'0     ~~~~~~~~~~~~~~~~
check:18                       X~~~~~~~~~~ error: no match found
           20:  let mut _0: i32; 
check:18       ~~~~~~~~~~~~~~~~~~
           21:  let mut _1: bool; 
check:18       ~~~~~~~~~~~~~~~~~~~
           22:  
check:18       ~
---


---- [mir-opt] tests/mir-opt/pre-codegen/checked_ops.rs stdout ----

error: verification with 'FileCheck' failed
status: exit status: 1
command: "/usr/lib/llvm-19/bin/FileCheck" "--input-file" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/pre-codegen/checked_ops/checked_ops.mir" "/checkout/tests/mir-opt/pre-codegen/checked_ops.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/checkout/tests/mir-opt/pre-codegen/checked_ops.rs:32:12: error: CHECK: expected string not found in input
 // CHECK: [[TEMP1:_.+]] = Option::<u32>::Some(move [[DELTA]]);
           ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/pre-codegen/checked_ops/checked_ops.mir:154:37: note: scanning from here
 _4 = SubUnchecked(copy _1, copy _2);
                                    ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/pre-codegen/checked_ops/checked_ops.mir:154:37: note: with "DELTA" equal to "_4"
 _4 = SubUnchecked(copy _1, copy _2);
                                    ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/pre-codegen/checked_ops/checked_ops.mir:155:2: note: possible intended match here
 _5 = Option::<u32>::Some(copy _4);
 ^
/checkout/tests/mir-opt/pre-codegen/checked_ops.rs:47:12: error: CHECK: expected string not found in input
 // CHECK: [[TEMP2:_.+]] = {{move|copy}} (([[TEMP1]] as Some).0: u32);
           ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/pre-codegen/checked_ops/checked_ops.mir:196:36: note: scanning from here
 _5 = Option::<u32>::Some(copy _4);
                                   ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/pre-codegen/checked_ops/checked_ops.mir:196:36: note: with "TEMP1" equal to "_5"
 _5 = Option::<u32>::Some(copy _4);
                                   ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/pre-codegen/checked_ops/checked_ops.mir:207:2: note: possible intended match here
 _0 = const 0_u32;
 ^

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/pre-codegen/checked_ops/checked_ops.mir
Check file: /checkout/tests/mir-opt/pre-codegen/checked_ops.rs

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            .
            .
            .
           54:  StorageDead(_6); 
           55:  goto -> bb7; 
           56:  } 
           57:  
           58:  bb3: { 
           59:  _7 = std::intrinsics::cold_path() -> [return: bb4, unwind unreachable]; 
           60:  } 
           61:  
           62:  bb4: { 
           63:  StorageDead(_5); 
           64:  StorageDead(_6); 
           65:  goto -> bb6; 
           66:  } 
           67:  
           68:  bb5: { 
           69:  StorageDead(_3); 
           70:  goto -> bb6; 
           71:  } 
           72:  
           73:  bb6: { 
           74:  assert(!const true, "attempt to compute `{} + {}`, which would overflow", const core::num::<impl u16>::MAX, const 1_u16) -> [success: bb7, unwind continue]; 
           75:  } 
           76:  
           77:  bb7: { 
           78:  StorageLive(_8); 
           79:  _8 = copy _2 as u16 (IntToInt); 
           80:  _0 = Add(copy _1, copy _8); 
           81:  StorageDead(_8); 
           82:  StorageDead(_4); 
           83:  return; 
           84:  } 
           85: } 
           86:  
           87: fn checked_shl(_1: u32, _2: u32) -> Option<u32> { 
           88:  debug x => _1; 
           89:  debug rhs => _2; 
           90:  let mut _0: std::option::Option<u32>; 
           91:  scope 1 (inlined core::num::<impl u32>::checked_shl) { 
           92:  let mut _3: bool; 
           93:  let mut _4: u32; 
           94:  scope 2 (inlined core::num::<impl u32>::unchecked_shl) { 
           95:  scope 3 (inlined core::ub_checks::check_language_ub) { 
           96:  scope 4 (inlined core::ub_checks::check_language_ub::runtime) { 
           97:  } 
           98:  } 
           99:  } 
          100:  } 
          101:  
          102:  bb0: { 
          103:  StorageLive(_3); 
          104:  _3 = Lt(copy _2, const core::num::<impl u32>::BITS); 
          105:  switchInt(move _3) -> [0: bb1, otherwise: bb2]; 
          106:  } 
          107:  
          108:  bb1: { 
          109:  _0 = const Option::<u32>::None; 
          110:  goto -> bb3; 
          111:  } 
          112:  
          113:  bb2: { 
          114:  StorageLive(_4); 
          115:  _4 = ShlUnchecked(copy _1, copy _2); 
          116:  _0 = Option::<u32>::Some(move _4); 
          117:  StorageDead(_4); 
          118:  goto -> bb3; 
          119:  } 
          120:  
          121:  bb3: { 
          122:  StorageDead(_3); 
          123:  return; 
          124:  } 
          125: } 
          126:  
          127: alloc4 (size: 8, align: 4) { 
          128:  00 00 00 00 __ __ __ __ │ ....░░░░ 
          129: } 
          130:  
          131: fn use_checked_sub(_1: u32, _2: u32) -> () { 
          132:  debug x => _1; 
          133:  debug rhs => _2; 
          134:  let mut _0: (); 
          135:  let mut _5: std::option::Option<u32>; 
          136:  let _7: (); 
          137:  scope 1 { 
          138:  debug delta => _6; 
          139:  let _6: u32; 
          140:  scope 2 (inlined core::num::<impl u32>::checked_sub) { 
          141:  let mut _3: bool; 
          142:  let mut _4: u32; 
          143:  } 
          144:  } 
          145:  
          146:  bb0: { 
          147:  StorageLive(_5); 
          148:  StorageLive(_3); 
          149:  _3 = Lt(copy _1, copy _2); 
          150:  switchInt(move _3) -> [0: bb1, otherwise: bb2]; 
          151:  } 
          152:  
          153:  bb1: { 
          154:  _4 = SubUnchecked(copy _1, copy _2); 
check:32'0                                         X~ error: no match found
check:32'1                                            with "DELTA" equal to "_4"
          155:  _5 = Option::<u32>::Some(copy _4); 
check:32'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:32'2      ?                                   possible intended match
          156:  StorageDead(_3); 
check:32'0     ~~~~~~~~~~~~~~~~~~
          157:  _6 = copy _4; 
check:32'0     ~~~~~~~~~~~~~~~
          158:  _7 = do_something(copy _4) -> [return: bb3, unwind continue]; 
check:32'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          159:  } 
check:32'0     ~~~
          160:  
check:32'0     ~
          161:  bb2: { 
check:32'0     ~~~~~~~~
          162:  StorageDead(_3); 
---
check:32'0     ~~~
          170: } 
check:32'0     ~~
          171:  
check:32'0     ~
          172: fn saturating_sub_at_home(_1: u32, _2: u32) -> u32 { 
check:32'0     ~~~~~~~~~~~~~~~~~~~~~~~~~
          173:  debug lhs => _1; 
          174:  debug rhs => _2; 
          175:  let mut _0: u32; 
          176:  let mut _5: std::option::Option<u32>; 
          177:  scope 1 (inlined core::num::<impl u32>::checked_sub) { 
          178:  let mut _3: bool; 
          179:  let mut _4: u32; 
          180:  } 
          181:  scope 2 (inlined Option::<u32>::unwrap_or) { 
          182:  let _6: u32; 
          183:  scope 3 { 
          184:  } 
          185:  } 
          186:  
          187:  bb0: { 
          188:  StorageLive(_5); 
          189:  StorageLive(_3); 
          190:  _3 = Lt(copy _1, copy _2); 
          191:  switchInt(move _3) -> [0: bb1, otherwise: bb2]; 
          192:  } 
          193:  
          194:  bb1: { 
          195:  _4 = SubUnchecked(copy _1, copy _2); 
          196:  _5 = Option::<u32>::Some(copy _4); 
check:47'0                                        X error: no match found
check:47'1                                          with "TEMP1" equal to "_5"
          197:  StorageDead(_3); 
check:47'0     ~~~~~~~~~~~~~~~~~~
          198:  StorageLive(_6); 
check:47'0     ~~~~~~~~~~~~~~~~~~
          199:  _6 = copy _4; 
check:47'0     ~~~~~~~~~~~~~~~
          200:  _0 = copy _4; 
check:47'0     ~~~~~~~~~~~~~~~
          201:  StorageDead(_6); 
check:47'0     ~~~~~~~~~~~~~~~~~~
          202:  goto -> bb3; 
check:47'0     ~~~~~~~~~~~~~~
          203:  } 
check:47'0     ~~~
          204:  
check:47'0     ~
          205:  bb2: { 
check:47'0     ~~~~~~~~
          206:  StorageDead(_3); 
check:47'0     ~~~~~~~~~~~~~~~~~~
          207:  _0 = const 0_u32; 
check:47'0     ~~~~~~~~~~~~~~~~~~~
check:47'2      ?                  possible intended match
          208:  goto -> bb3; 
check:47'0     ~~~~~~~~~~~~~~
          209:  } 
check:47'0     ~~~
          210:  
check:47'0     ~
          211:  bb3: { 
check:47'0     ~~~~~~~~
          212:  StorageDead(_5); 
---


---- [mir-opt] tests/mir-opt/optimize_none.rs#SPEED-OPT stdout ----

error in revision `SPEED-OPT`: verification with 'FileCheck' failed
status: exit status: 1
command: "/usr/lib/llvm-19/bin/FileCheck" "--input-file" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/optimize_none.SPEED-OPT/optimize_none.mir" "/checkout/tests/mir-opt/optimize_none.rs" "--check-prefix=CHECK" "--check-prefix" "SPEED-OPT" "--allow-unused-prefixes" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/checkout/tests/mir-opt/optimize_none.rs:10:12: error: CHECK: expected string not found in input
 // CHECK: AddWithOverflow(const 1_i32, const 2_i32);
           ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/optimize_none.SPEED-OPT/optimize_none.mir:4:14: note: scanning from here
fn add_noopt() -> i32 {
             ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/optimize_none.SPEED-OPT/optimize_none.mir:9:2: note: possible intended match here
 _1 = const (3_i32, false);
 ^
/checkout/tests/mir-opt/optimize_none.rs:18:12: error: CHECK: expected string not found in input
 // CHECK: switchInt(const true) -> [0: [[FALSE:bb[0-9]+]], otherwise: [[TRUE:bb[0-9]+]]];
           ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/optimize_none.SPEED-OPT/optimize_none.mir:19:17: note: scanning from here
fn const_branch() -> i32 {
                ^

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/optimize_none.SPEED-OPT/optimize_none.mir
Check file: /checkout/tests/mir-opt/optimize_none.rs

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: // WARNING: This output format is intended for human consumers only 
            2: // and is subject to change without notice. Knock yourself out. 
            3: // HINT: See also -Z dump-mir for MIR at specific points during compilation. 
            4: fn add_noopt() -> i32 { 
check:10'0                  X~~~~~~~~~~ error: no match found
            5:  let mut _0: i32; 
check:10'0     ~~~~~~~~~~~~~~~~~~
            6:  let mut _1: (i32, bool); 
check:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
            7:  
check:10'0     ~
            8:  bb0: { 
check:10'0     ~~~~~~~~
            9:  _1 = const (3_i32, false); 
check:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:10'1      ?                           possible intended match
           10:  _0 = const 3_i32; 
check:10'0     ~~~~~~~~~~~~~~~~~~~
           11:  return; 
check:10'0     ~~~~~~~~~
           12:  } 
check:10'0     ~~~
           13: } 
check:10'0     ~~
           14:  
check:10'0     ~
           15: alloc1 (size: 8, align: 4) { 
check:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           16:  03 00 00 00 00 __ __ __ │ .....░░░ 
check:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           17: } 
check:10'0     ~~
           18:  
check:10'0     ~
           19: fn const_branch() -> i32 { 
check:10'0     ~~~~~~~~~~~~~~~~
check:18                       X~~~~~~~~~~ error: no match found
           20:  let mut _0: i32; 
check:18       ~~~~~~~~~~~~~~~~~~
           21:  let mut _1: bool; 
check:18       ~~~~~~~~~~~~~~~~~~~
           22:  
check:18       ~
---


---- [mir-opt] tests/mir-opt/pre-codegen/simple_option_map.rs stdout ----

error: verification with 'FileCheck' failed
status: exit status: 1
command: "/usr/lib/llvm-19/bin/FileCheck" "--input-file" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/pre-codegen/simple_option_map/simple_option_map.mir" "/checkout/tests/mir-opt/pre-codegen/simple_option_map.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/checkout/tests/mir-opt/pre-codegen/simple_option_map.rs:33:12: error: CHECK: expected string not found in input
 // CHECK: [[TEMP2:_.+]] = copy (([[TEMP1]] as Continue).0: i32);
           ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/pre-codegen/simple_option_map/simple_option_map.mir:154:65: note: scanning from here
 _4 = ControlFlow::<Option<Infallible>, i32>::Continue(copy _3);
                                                                ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/pre-codegen/simple_option_map/simple_option_map.mir:154:65: note: with "TEMP1" equal to "_4"
 _4 = ControlFlow::<Option<Infallible>, i32>::Continue(copy _3);
                                                                ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/pre-codegen/simple_option_map/simple_option_map.mir:157:10: note: possible intended match here
 _6 = Add(copy _3, const 1_i32);
         ^

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/pre-codegen/simple_option_map/simple_option_map.mir
Check file: /checkout/tests/mir-opt/pre-codegen/simple_option_map.rs

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            .
            .
            .
           54: fn ezmap(_1: Option<i32>) -> Option<i32> { 
           55:  debug x => _1; 
           56:  let mut _0: std::option::Option<i32>; 
           57:  scope 1 (inlined map::<i32, i32, {closure@/checkout/tests/mir-opt/pre-codegen/simple_option_map.rs:23:12: 23:15}>) { 
           58:  let mut _2: isize; 
           59:  let _3: i32; 
           60:  let mut _4: i32; 
           61:  scope 2 { 
           62:  scope 3 (inlined ezmap::{closure#0}) { 
           63:  } 
           64:  } 
           65:  } 
           66:  
           67:  bb0: { 
           68:  StorageLive(_2); 
           69:  _2 = discriminant(_1); 
           70:  switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb4]; 
           71:  } 
           72:  
           73:  bb1: { 
           74:  _0 = const Option::<i32>::None; 
           75:  goto -> bb3; 
           76:  } 
           77:  
           78:  bb2: { 
           79:  _3 = copy ((_1 as Some).0: i32); 
           80:  StorageLive(_4); 
           81:  _4 = Add(copy _3, const 1_i32); 
           82:  _0 = Option::<i32>::Some(move _4); 
           83:  StorageDead(_4); 
           84:  goto -> bb3; 
           85:  } 
           86:  
           87:  bb3: { 
           88:  StorageDead(_2); 
           89:  return; 
           90:  } 
           91:  
           92:  bb4: { 
           93:  unreachable; 
           94:  } 
           95: } 
           96:  
           97: alloc5 (size: 8, align: 4) { 
           98:  00 00 00 00 __ __ __ __ │ ....░░░░ 
           99: } 
          100:  
          101: fn ezmap::{closure#0}(_1: {closure@/checkout/tests/mir-opt/pre-codegen/simple_option_map.rs:23:12: 23:15}, _2: i32) -> i32 { 
          102:  debug n => _2; 
          103:  let mut _0: i32; 
          104:  
          105:  bb0: { 
          106:  _0 = Add(copy _2, const 1_i32); 
          107:  return; 
          108:  } 
          109: } 
          110:  
          111: fn map_via_question_mark(_1: Option<i32>) -> Option<i32> { 
          112:  debug x => _1; 
          113:  let mut _0: std::option::Option<i32>; 
          114:  let mut _4: std::ops::ControlFlow<std::option::Option<std::convert::Infallible>, i32>; 
          115:  let _5: i32; 
          116:  let mut _6: i32; 
          117:  scope 1 { 
          118:  debug residual => const Option::<Infallible>::None; 
          119:  scope 2 { 
          120:  scope 7 (inlined <Option<i32> as FromResidual<Option<Infallible>>>::from_residual) { 
          121:  } 
          122:  } 
          123:  } 
          124:  scope 3 { 
          125:  debug val => _5; 
          126:  scope 4 { 
          127:  } 
          128:  } 
          129:  scope 5 (inlined <Option<i32> as Try>::branch) { 
          130:  let mut _2: isize; 
          131:  let _3: i32; 
          132:  scope 6 { 
          133:  } 
          134:  } 
          135:  
          136:  bb0: { 
          137:  StorageLive(_6); 
          138:  StorageLive(_4); 
          139:  StorageLive(_2); 
          140:  _2 = discriminant(_1); 
          141:  switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb4]; 
          142:  } 
          143:  
          144:  bb1: { 
          145:  StorageDead(_2); 
          146:  _0 = const Option::<i32>::None; 
          147:  StorageDead(_6); 
          148:  StorageDead(_4); 
          149:  goto -> bb3; 
          150:  } 
          151:  
          152:  bb2: { 
          153:  _3 = copy ((_1 as Some).0: i32); 
          154:  _4 = ControlFlow::<Option<Infallible>, i32>::Continue(copy _3); 
check:33'0                                                                     X error: no match found
check:33'1                                                                       with "TEMP1" equal to "_4"
          155:  StorageDead(_2); 
check:33'0     ~~~~~~~~~~~~~~~~~~
          156:  _5 = copy _3; 
check:33'0     ~~~~~~~~~~~~~~~
          157:  _6 = Add(copy _3, const 1_i32); 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:33'2              ?                        possible intended match
          158:  _0 = Option::<i32>::Some(move _6); 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          159:  StorageDead(_6); 
check:33'0     ~~~~~~~~~~~~~~~~~~
          160:  StorageDead(_4); 
check:33'0     ~~~~~~~~~~~~~~~~~~
          161:  goto -> bb3; 
check:33'0     ~~~~~~~~~~~~~~
          162:  } 
check:33'0     ~~~
          163:  
check:33'0     ~
          164:  bb3: { 
check:33'0     ~~~~~~~~
          165:  return; 
---
check:33'0     ~~~
          171: } 
check:33'0     ~~
          172:  
check:33'0     ~
          173: alloc7 (size: 8, align: 4) { 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          174:  00 00 00 00 __ __ __ __ │ ....░░░░ 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          175: } 
check:33'0     ~~
          176:  
check:33'0     ~
          177: fn main() -> () { 
check:33'0     ~~~~~~~~~~~~~~~~~~
          178:  let mut _0: (); 
check:33'0     ~~~~~~~~~~~~~~~~~
          179:  let mut _1: &std::option::Option<i32>; 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          180:  let _2: std::option::Option<i32>; 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          181:  let mut _3: &std::option::Option<i32>; 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          182:  let mut _5: bool; 
check:33'0     ~~~~~~~~~~~~~~~~~~~
          183:  let mut _6: std::option::Option<std::fmt::Arguments<'_>>; 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          184:  let _7: !; 
check:33'0     ~~~~~~~~~~~~
          185:  let mut _8: &std::option::Option<i32>; 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          186:  let _9: std::option::Option<i32>; 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          187:  let mut _10: &std::option::Option<i32>; 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          188:  let mut _12: bool; 
check:33'0     ~~~~~~~~~~~~~~~~~~~~
          189:  let mut _13: std::option::Option<std::fmt::Arguments<'_>>; 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          190:  let _14: !; 
check:33'0     ~~~~~~~~~~~~~
          191:  scope 1 { 
check:33'0     ~~~~~~~~~~~
          192:  debug left_val => _1; 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~
          193:  debug right_val => _3; 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~
          194:  scope 2 { 
check:33'0     ~~~~~~~~~~~
          195:  debug kind => const core::panicking::AssertKind::Eq; 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          196:  } 
check:33'0     ~~~
          197:  scope 9 (inlined <Option<i32> as PartialEq>::eq) { 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          198:  let mut _4: isize; 
check:33'0     ~~~~~~~~~~~~~~~~~~~~
          199:  scope 10 { 
check:33'0     ~~~~~~~~~~~~
          200:  scope 11 (inlined std::cmp::impls::<impl PartialEq for i32>::eq) { 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          201:  } 
check:33'0     ~~~
          202:  } 
check:33'0     ~~~
          203:  } 
check:33'0     ~~~
          204:  } 
check:33'0     ~~~
          205:  scope 3 { 
check:33'0     ~~~~~~~~~~~
          206:  debug left_val => _8; 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~
          207:  debug right_val => _10; 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~
          208:  scope 4 { 
check:33'0     ~~~~~~~~~~~
          209:  debug kind => const core::panicking::AssertKind::Eq; 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          210:  } 
check:33'0     ~~~
          211:  scope 20 (inlined <Option<i32> as PartialEq>::eq) { 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          212:  let mut _11: isize; 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~
          213:  scope 21 { 
check:33'0     ~~~~~~~~~~~~
          214:  scope 22 (inlined std::cmp::impls::<impl PartialEq for i32>::eq) { 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          215:  } 
check:33'0     ~~~
          216:  } 
check:33'0     ~~~
          217:  } 
check:33'0     ~~~
          218:  } 
check:33'0     ~~~
          219:  scope 5 (inlined ezmap) { 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
          220:  scope 6 (inlined map::<i32, i32, {closure@/checkout/tests/mir-opt/pre-codegen/simple_option_map.rs:23:12: 23:15}>) { 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          221:  scope 7 { 
check:33'0     ~~~~~~~~~~~
          222:  scope 8 (inlined ezmap::{closure#0}) { 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          223:  } 
check:33'0     ~~~
          224:  } 
check:33'0     ~~~
          225:  } 
check:33'0     ~~~
          226:  } 
check:33'0     ~~~
          227:  scope 12 (inlined map_via_question_mark) { 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          228:  scope 13 { 
check:33'0     ~~~~~~~~~~~~
          229:  scope 14 { 
check:33'0     ~~~~~~~~~~~~
          230:  scope 19 (inlined <Option<i32> as FromResidual<Option<Infallible>>>::from_residual) { 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          231:  } 
check:33'0     ~~~
          232:  } 
check:33'0     ~~~
          233:  } 
check:33'0     ~~~
          234:  scope 15 { 
check:33'0     ~~~~~~~~~~~~
          235:  scope 16 { 
check:33'0     ~~~~~~~~~~~~
          236:  } 
check:33'0     ~~~
          237:  } 
check:33'0     ~~~
          238:  scope 17 (inlined <Option<i32> as Try>::branch) { 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          239:  scope 18 { 
check:33'0     ~~~~~~~~~~~~
          240:  } 
check:33'0     ~~~
          241:  } 
check:33'0     ~~~
          242:  } 
check:33'0     ~~~
          243:  
check:33'0     ~
          244:  bb0: { 
check:33'0     ~~~~~~~~
          245:  _1 = const main::promoted[1]; 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          246:  _2 = const Option::<i32>::None; 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          247:  _3 = &_2; 
check:33'0     ~~~~~~~~~~~
          248:  StorageLive(_4); 
check:33'0     ~~~~~~~~~~~~~~~~~~
          249:  _4 = const 0_isize; 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~
          250:  _5 = const true; 
check:33'0     ~~~~~~~~~~~~~~~~~~
          251:  StorageDead(_4); 
check:33'0     ~~~~~~~~~~~~~~~~~~
          252:  _8 = const main::promoted[0]; 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          253:  _9 = const Option::<i32>::None; 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          254:  _10 = &_9; 
check:33'0     ~~~~~~~~~~~~
          255:  StorageLive(_12); 
check:33'0     ~~~~~~~~~~~~~~~~~~~
          256:  StorageLive(_11); 
check:33'0     ~~~~~~~~~~~~~~~~~~~
          257:  _11 = const 0_isize; 
check:33'0     ~~~~~~~~~~~~~~~~~~~~~~
            .
            .
            .
>>>>>>
------------------------------------------

@bors
Copy link
Collaborator

bors commented May 1, 2025

☀️ Try build successful - checks-actions
Build commit: 8c46fcb (8c46fcbb191b4a054f15dac8d411078faa679379)

@rust-timer
Copy link
Collaborator

Queued 8c46fcb with parent 0c33fe2, future comparison URL.
There are currently 0 preceding artifacts in the queue.
It will probably take at least ~1.5 hours until the benchmark run finishes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-perf Status: Waiting on a perf run to be completed. 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.

7 participants