Skip to content

Turn TrapUnreachable off by default #88826

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

Closed
wants to merge 2 commits into from
Closed

Turn TrapUnreachable off by default #88826

wants to merge 2 commits into from

Conversation

jonas-schievink
Copy link
Contributor

Now that #28728 is fixed, there's no longer a risk of programs executing past the end of a function, so we don't have to put a trap instruction there anymore.

This should ever so slightly shrink the average Rust program.

(the second commit is a drive-by-fix that reverts an incorrect part of 62e7331, which made the alloc-optimisation.rs test fail with my system's LLVM)

@rust-highfive
Copy link
Contributor

r? @oli-obk

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive
Copy link
Contributor

⚠️ Warning ⚠️

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 10, 2021
@Mark-Simulacrum
Copy link
Member

@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 Sep 10, 2021
@bors
Copy link
Collaborator

bors commented Sep 10, 2021

⌛ Trying commit 4d545d9 with merge c95266130c4724381de0a769a741cf934583d48d...

@bors
Copy link
Collaborator

bors commented Sep 10, 2021

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

@rust-timer
Copy link
Collaborator

Queued c95266130c4724381de0a769a741cf934583d48d with parent 7bf0736, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (c95266130c4724381de0a769a741cf934583d48d): comparison url.

Summary: This change led to large relevant improvements 🎉 in compiler performance.

  • Large improvement in instruction counts (up to -2.3% on full builds of piston-image)

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

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 led to changes in compiler perf.

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

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 10, 2021
@nikic
Copy link
Contributor

nikic commented Sep 10, 2021

FWIW upstream is considering turning on TrapUnreachable or some variant thereof on by default, to at least prevent zero-size functions.

I think a more conservative step we can take is to enable the NoTrapAfterNoreturn option, which probably is the form in which the vast majority of unreachable appears in rust code (basically after every panic), and also the one where it has little practical benefit.

@oli-obk
Copy link
Contributor

oli-obk commented Sep 13, 2021

I don't know enough about the effects of this to review this properly.

r? @nikic

@rust-highfive rust-highfive assigned nikic and unassigned oli-obk Sep 13, 2021
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 3, 2021
@apiraino apiraino added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Oct 14, 2021
@pnkfelix
Copy link
Member

FWIW upstream is considering turning on TrapUnreachable or some variant thereof on by default, to at least prevent zero-size functions.

I think a more conservative step we can take is to enable the NoTrapAfterNoreturn option, which probably is the form in which the vast majority of unreachable appears in rust code (basically after every panic), and also the one where it has little practical benefit.

I think this should be revised to take the more conservative approach quoted here.

Changing to S-waiting-on-author for that revision

@pnkfelix pnkfelix 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-review Status: Awaiting review from the assignee but also interested parties. labels Oct 28, 2021
@JohnCSimon JohnCSimon 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 14, 2021
@JohnCSimon JohnCSimon 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 12, 2021
@JohnCSimon
Copy link
Member

Ping from triage:
@jonas-schievink Can you please post the status of this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.