Skip to content

Conversation

dianqk
Copy link
Member

@dianqk dianqk commented Oct 14, 2025

After InstSimplify-after-simplifycfg with -Zub_checks=false, there are many of the following patterns.

_13 = const false; assume(copy _13); _12 = unreachable_unchecked::precondition_check() -> [return: bb1, unwind unreachable]; 

Simplifying them to unreachable early should make CFG simpler.

@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 Oct 14, 2025
@dianqk
Copy link
Member Author

dianqk commented Oct 14, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Oct 14, 2025
Simplify trivial constants in SimplifyConstCondition
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 14, 2025
@rust-bors
Copy link

rust-bors bot commented Oct 14, 2025

☀️ Try build successful (CI)
Build commit: 2d02757 (2d0275706b38d9e50cb9131ae9dc3ae769529a20, parent: 4b94758d2ba7d0ef71ccf5fde29ce4bc5d6fe2a4)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (2d02757): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

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

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.2% [-0.4%, -0.1%] 9
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 0.7%)

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

mean range count
Regressions ❌
(primary)
4.9% [4.9%, 4.9%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.6% [-3.6%, -3.6%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.7% [-3.6%, 4.9%] 2

Cycles

Results (secondary 3.0%)

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)
3.0% [2.5%, 3.5%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

Results (primary 0.0%, secondary 0.0%)

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

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

Bootstrap: 475.312s -> 475.552s (0.05%)
Artifact size: 388.16 MiB -> 388.14 MiB (-0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 14, 2025
@dianqk dianqk force-pushed the simplify-const-condition branch from 3877315 to dcd9af0 Compare October 14, 2025 13:36
@dianqk
Copy link
Member Author

dianqk commented Oct 14, 2025

@bors2 try parent=last @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Oct 14, 2025
Simplify trivial constants in SimplifyConstCondition
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 14, 2025
@dianqk dianqk marked this pull request as ready for review October 14, 2025 13:49
@rustbot
Copy link
Collaborator

rustbot commented Oct 14, 2025

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 14, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 14, 2025

r? @davidtwco

rustbot has assigned @davidtwco.
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

@rust-bors
Copy link

rust-bors bot commented Oct 14, 2025

☀️ Try build successful (CI)
Build commit: 2b77d79 (2b77d79571afb4b51d2e238b5007f06b01912318, parent: 4b94758d2ba7d0ef71ccf5fde29ce4bc5d6fe2a4)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (2b77d79): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

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

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.2% [-0.3%, -0.1%] 9
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 0.9%)

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

mean range count
Regressions ❌
(primary)
4.7% [4.7%, 4.7%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.0% [-3.0%, -3.0%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.9% [-3.0%, 4.7%] 2

Cycles

Results (secondary 3.5%)

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)
3.5% [3.5%, 3.5%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

Results (primary 0.0%, secondary 0.0%)

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

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

Bootstrap: 475.312s -> 474.926s (-0.08%)
Artifact size: 388.16 MiB -> 388.14 MiB (-0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 14, 2025
// optimizations. This invalidates CFG caches, so avoid putting between
// `ReferencePropagation` and `GVN` which both use the dominator tree.
&instsimplify::InstSimplify::AfterSimplifyCfg,
&o1(simplify_branches::SimplifyConstCondition::AfterInstSimplify),
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a comment to explain why you put this pass here?

@cjgillot cjgillot self-assigned this Oct 15, 2025
@davidtwco davidtwco removed their assignment Oct 15, 2025
@dianqk dianqk force-pushed the simplify-const-condition branch from bdc9444 to 0db7401 Compare October 16, 2025 13:30
@rustbot
Copy link
Collaborator

rustbot commented Oct 16, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@dianqk dianqk force-pushed the simplify-const-condition branch from 0db7401 to 909fbcb Compare October 16, 2025 14:30
| TerminatorKind::UnwindTerminate(_)
| TerminatorKind::Return
| TerminatorKind::Assert { .. }
| TerminatorKind::Yield { .. }
Copy link
Contributor

Choose a reason for hiding this comment

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

Yield writes to the resume_arg place.

@dianqk dianqk force-pushed the simplify-const-condition branch from 909fbcb to 7af5775 Compare October 16, 2025 15:03
@cjgillot
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Oct 16, 2025

📌 Commit 7af5775 has been approved by cjgillot

It is now in the queue for this repository.

@bors bors 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 16, 2025
bors added a commit that referenced this pull request Oct 17, 2025
Simplify trivial constants in SimplifyConstCondition After `InstSimplify-after-simplifycfg` with `-Zub_checks=false`, there are many of the following patterns. ``` _13 = const false; assume(copy _13); _12 = unreachable_unchecked::precondition_check() -> [return: bb1, unwind unreachable]; ``` Simplifying them to unreachable early should make CFG simpler.
@bors
Copy link
Collaborator

bors commented Oct 17, 2025

⌛ Testing commit 7af5775 with merge 883b4e0...

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-msvc-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
 error: test failed, to rerun pass `-p std --test sync` Bootstrap failed while executing `test --stage 2 --skip=compiler --skip=src` Build completed unsuccessfully in 1:52:38 make: *** [Makefile:112: ci-msvc-py] Error 1 local time: Fri Oct 17 13:07:54 CUT 2025 network time: Fri, 17 Oct 2025 13:07:54 GMT ##[error]Process completed with exit code 2. ##[group]Run echo "disk usage:" echo "disk usage:" 
@bors
Copy link
Collaborator

bors commented Oct 17, 2025

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 17, 2025
@bors bors 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 17, 2025
bors added a commit that referenced this pull request Oct 17, 2025
Simplify trivial constants in SimplifyConstCondition After `InstSimplify-after-simplifycfg` with `-Zub_checks=false`, there are many of the following patterns. ``` _13 = const false; assume(copy _13); _12 = unreachable_unchecked::precondition_check() -> [return: bb1, unwind unreachable]; ``` Simplifying them to unreachable early should make CFG simpler.
@bors
Copy link
Collaborator

bors commented Oct 17, 2025

⌛ Testing commit 7af5775 with merge ea28252...

@rust-log-analyzer
Copy link
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
[WARNING] `tests/rustdoc-gui/search-result-display.goml` line 39: Delta is 0 for "x", maybe try to use `compare-elements-position` instead? ======== tests/rustdoc-gui/sidebar-macro-reexport.goml ======== [ERROR] `tests/rustdoc-gui/sidebar-macro-reexport.goml` line 3: Error: Navigating frame was detached: for command `go-to: "file://" + |DOC_PATH| + "/test_docs/macro.repro.html"` `tests/rustdoc-gui/sidebar-macro-reexport.goml` sidebar-macro-reexport output: Protocol error: Connection closed. Most likely the page has been closed. stack: Error: Protocol error: Connection closed. Most likely the page has been closed. at assert (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/puppeteer-core/lib/cjs/puppeteer/util/assert.js:18:15) at CdpPage.close (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Page.js:814:36) at async runAllCommands (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/browser-ui-test/src/index.js:433:13) at async innerRunTestCode (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/browser-ui-test/src/index.js:696:21) at async innerRunTests (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/browser-ui-test/src/index.js:633:17) at async runTests (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/browser-ui-test/src/index.js:824:27) ======== tests/rustdoc-gui/sidebar-macro-reexport.goml ======== [ERROR] `tests/rustdoc-gui/sidebar-macro-reexport.goml` line 3: Error: Navigating frame was detached: for command `go-to: "file://" + |DOC_PATH| + "/test_docs/macro.repro.html"` `tests/rustdoc-gui/sidebar-macro-reexport.goml` sidebar-macro-reexport output: Protocol error: Connection closed. Most likely the page has been closed. stack: Error: Protocol error: Connection closed. Most likely the page has been closed. at assert (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/puppeteer-core/lib/cjs/puppeteer/util/assert.js:18:15) at CdpPage.close (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Page.js:814:36) at async runAllCommands (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/browser-ui-test/src/index.js:433:13) at async innerRunTestCode (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/browser-ui-test/src/index.js:696:21) at async innerRunTests (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/browser-ui-test/src/index.js:633:17) at async runTests (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/browser-ui-test/src/index.js:824:27) <= doc-ui tests done: 142 succeeded, 1 failed, 0 filtered out 
@bors
Copy link
Collaborator

bors commented Oct 17, 2025

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 17, 2025
@cjgillot
Copy link
Contributor

@bors retry

@bors bors 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 17, 2025
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.

8 participants