Skip to content
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

Enable the LLVM option NoTrapAfterNoreturn when TrapUnreachable is enabled. #618

Closed
3 tasks done
majaha opened this issue Apr 18, 2023 · 5 comments
Closed
3 tasks done
Labels
major-change A proposal to make a major change to rustc major-change-accepted A major change proposal that was accepted T-compiler Add this label so rfcbot knows to poll the compiler team

Comments

@majaha
Copy link

majaha commented Apr 18, 2023

Proposal

Rustc emits two traps when one would do, when TrapUnreachable is enabled (Godbolt) for most targets.
After some semi-related investigation (rust-lang/rust#102132), I came to the conclusion that using LLVM's NoTrapAfterNoreturn TargetOption would mostly solve this (for x86 and arm, but not wasm).

On @nikic's advice, I'm filing an MCP to make sure no-one has any concerns about this.

I propose to set this in the llvm wrapper, whenever TrapUnreachable is set:
majaha/rust@6fa99de

Apparently, NoTrapAfterNoreturn is undesireable on some targets like Playstation consoles. LLVM will override us in that case.

Mentors or Reviewers

@nikic

Process

The main points of the Major Change Process are as follows:

  • File an issue describing the proposal.
  • A compiler team member or contributor who is knowledgeable in the area can second by writing @rustbot second.
    • Finding a "second" suffices for internal changes. If however, you are proposing a new public-facing feature, such as a -C flag, then full team check-off is required.
    • Compiler team members can initiate a check-off via @rfcbot fcp merge on either the MCP or the PR.
  • Once an MCP is seconded, the Final Comment Period begins. If no objections are raised after 10 days, the MCP is considered approved.

You can read more about Major Change Proposals on forge.

Comments

This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.

@majaha majaha added major-change A proposal to make a major change to rustc T-compiler Add this label so rfcbot knows to poll the compiler team labels Apr 18, 2023
@rustbot
Copy link
Collaborator

rustbot commented Apr 18, 2023

This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.

cc @rust-lang/compiler @rust-lang/compiler-contributors

@rustbot rustbot added the to-announce Announce this issue on triage meeting label Apr 18, 2023
@nikic
Copy link
Contributor

nikic commented Apr 18, 2023

@rustbot second

@rustbot rustbot added the final-comment-period The FCP has started, most (if not all) team members are in agreement label Apr 18, 2023
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Apr 20, 2023
@majaha
Copy link
Author

majaha commented Apr 30, 2023

10 days has passed, is it okay to merge this now?

@apiraino
Copy link
Contributor

apiraino commented May 2, 2023

@rustbot label -final-comment-period +major-change-accepted

@apiraino apiraino closed this as completed May 2, 2023
@rustbot rustbot added major-change-accepted A major change proposal that was accepted to-announce Announce this issue on triage meeting and removed final-comment-period The FCP has started, most (if not all) team members are in agreement labels May 2, 2023
@majaha
Copy link
Author

majaha commented May 3, 2023

Link to the relevant pull request: rust-lang/rust#110494

@apiraino apiraino removed the to-announce Announce this issue on triage meeting label May 25, 2023
TaKO8Ki added a commit to TaKO8Ki/rust that referenced this issue Jun 27, 2023
Use the LLVM option NoTrapAfterNoreturn

Use this LLVM option: https://llvm.org/doxygen/classllvm_1_1TargetOptions.html#acd83fce25de1ac9f6c975135a8235c22 when TrapUnreachable is enabled. This prevents codegenning unnecessary double-traps in some situations.

See further discussion here: rust-lang/compiler-team#618
bors added a commit to rust-lang-ci/rust that referenced this issue Nov 3, 2023
Use the LLVM option NoTrapAfterNoreturn

Use this LLVM option: https://llvm.org/doxygen/classllvm_1_1TargetOptions.html#acd83fce25de1ac9f6c975135a8235c22 when TrapUnreachable is enabled. This prevents codegenning unnecessary double-traps in some situations.

See further discussion here: rust-lang/compiler-team#618
bors added a commit to rust-lang-ci/rust that referenced this issue Nov 8, 2023
Use the LLVM option NoTrapAfterNoreturn

Use this LLVM option: https://llvm.org/doxygen/classllvm_1_1TargetOptions.html#acd83fce25de1ac9f6c975135a8235c22 when TrapUnreachable is enabled. This prevents codegenning unnecessary double-traps in some situations.

See further discussion here: rust-lang/compiler-team#618
TaKO8Ki added a commit to TaKO8Ki/rust that referenced this issue Nov 9, 2023
Use the LLVM option NoTrapAfterNoreturn

Use this LLVM option: https://llvm.org/doxygen/classllvm_1_1TargetOptions.html#acd83fce25de1ac9f6c975135a8235c22 when TrapUnreachable is enabled. This prevents codegenning unnecessary double-traps in some situations.

See further discussion here: rust-lang/compiler-team#618
bors added a commit to rust-lang-ci/rust that referenced this issue Dec 8, 2023
Use the LLVM option NoTrapAfterNoreturn

Use this LLVM option: https://llvm.org/doxygen/classllvm_1_1TargetOptions.html#acd83fce25de1ac9f6c975135a8235c22 when TrapUnreachable is enabled. This prevents codegenning unnecessary double-traps in some situations.

See further discussion here: rust-lang/compiler-team#618
bors added a commit to rust-lang-ci/rust that referenced this issue Dec 16, 2023
Use the LLVM option NoTrapAfterNoreturn

Use this LLVM option: https://llvm.org/doxygen/classllvm_1_1TargetOptions.html#acd83fce25de1ac9f6c975135a8235c22 when TrapUnreachable is enabled. This prevents codegenning unnecessary double-traps in some situations.

See further discussion here: rust-lang/compiler-team#618
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Dec 19, 2023
Use the LLVM option NoTrapAfterNoreturn

Use this LLVM option: https://llvm.org/doxygen/classllvm_1_1TargetOptions.html#acd83fce25de1ac9f6c975135a8235c22 when TrapUnreachable is enabled. This prevents codegenning unnecessary double-traps in some situations.

See further discussion here: rust-lang/compiler-team#618
lnicola pushed a commit to lnicola/rust-analyzer that referenced this issue Apr 7, 2024
Use the LLVM option NoTrapAfterNoreturn

Use this LLVM option: https://llvm.org/doxygen/classllvm_1_1TargetOptions.html#acd83fce25de1ac9f6c975135a8235c22 when TrapUnreachable is enabled. This prevents codegenning unnecessary double-traps in some situations.

See further discussion here: rust-lang/compiler-team#618
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this issue Apr 27, 2024
Use the LLVM option NoTrapAfterNoreturn

Use this LLVM option: https://llvm.org/doxygen/classllvm_1_1TargetOptions.html#acd83fce25de1ac9f6c975135a8235c22 when TrapUnreachable is enabled. This prevents codegenning unnecessary double-traps in some situations.

See further discussion here: rust-lang/compiler-team#618
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major-change A proposal to make a major change to rustc major-change-accepted A major change proposal that was accepted T-compiler Add this label so rfcbot knows to poll the compiler team
Projects
None yet
Development

No branches or pull requests

4 participants