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

Properly check target_features not to trigger an assertion #89937

Merged
merged 4 commits into from
Oct 27, 2021

Conversation

JohnTitor
Copy link
Member

@JohnTitor JohnTitor commented Oct 16, 2021

Fixes #89875
I think it should be a condition instead of an assertion to check if it's a register as it's possible that reg is a register class.
Also, this isn't related to the issue directly, but is_target_supported doesn't check target_features attributes. Is there any way to check it on rustc_codegen_llvm?

r? @Amanieu

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 16, 2021
@rust-log-analyzer

This comment has been minimized.

@Amanieu
Copy link
Member

Amanieu commented Oct 19, 2021

The assert is actually correct here, the problem is in the AST lowering pass. It should only allow clobbers for registers that are not supported by the current feature set if these are register clobbers, not register class clobbers.

@JohnTitor
Copy link
Member Author

Hmm, I'm not sure about the right condition then. Since #89641, the target_features check has been moved to rustc_passes, we should add a check there instead of rustc_ast_lowering, right? I'm also not sure how we skip clobbering on rustc_passes (or rustc_ast_lowering).

By the way, the test passes fine on my local and godbolt if I pass the target feature as a compile flag, but CI doesn't, any ideas?

@Amanieu
Copy link
Member

Amanieu commented Oct 20, 2021

OK, so I spent a while looking through the changes in this PR and #89641.

The original assert is still correct and shouldn't be removed. Instead the issue is in the FIXME that you added: if this is fixed to take function-specific target features into account then the assert will never trigger since is_target_supported will return true (which must be the case otherwise it would have been rejected by rustc_passes).

By the way, the test passes fine on my local and godbolt if I pass the target feature as a compile flag, but CI doesn't, any ideas?

CI uses LLVM 10 and the error message seems to come from LLVM. LLVM 10 doesn't support the 't' asm formatting code to print the register name as a ymm register. This is fixed in LLVM 10.0.1 but CI is on 10.0.1. This should be fixed by #90062 which updates the minimum LLVM version to LLVM 11.

@JohnTitor JohnTitor changed the title Do not assert it is a register in codegen_inline_asm Properly check target_features not to trigger an assertion Oct 20, 2021
@JohnTitor
Copy link
Member Author

Thanks for the help! I think is_target_supported now works properly and it's ready to re-review.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@JohnTitor
Copy link
Member Author

It now passes the tests, @Amanieu could you re-review?

@Amanieu
Copy link
Member

Amanieu commented Oct 26, 2021

@bors r+

@bors
Copy link
Contributor

bors commented Oct 26, 2021

📌 Commit 12647ea has been approved by Amanieu

@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 26, 2021
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 26, 2021
Properly check `target_features` not to trigger an assertion

Fixes rust-lang#89875
I think it should be a condition instead of an assertion to check if it's a register as it's possible that `reg` is a register class.
Also, this isn't related to the issue directly, but `is_target_supported` doesn't check `target_features` attributes. Is there any way to check it on rustc_codegen_llvm?

r? `@Amanieu`
@bors
Copy link
Contributor

bors commented Oct 26, 2021

⌛ Testing commit 12647ea with merge cf1e3d5e2c954b4dc3401f78cbb87d285f642b03...

@bors
Copy link
Contributor

bors commented Oct 27, 2021

💥 Test timed out

@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 27, 2021
@JohnTitor
Copy link
Member Author

@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 27, 2021
@bors
Copy link
Contributor

bors commented Oct 27, 2021

⌛ Testing commit 12647ea with merge a9b2bfb...

@bors
Copy link
Contributor

bors commented Oct 27, 2021

☀️ Test successful - checks-actions
Approved by: Amanieu
Pushing a9b2bfb to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Oct 27, 2021
@bors bors merged commit a9b2bfb into rust-lang:master Oct 27, 2021
@rustbot rustbot added this to the 1.58.0 milestone Oct 27, 2021
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a9b2bfb): comparison url.

Summary: This benchmark run did not return any relevant changes.

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

@rustbot label: -perf-regression

@JohnTitor JohnTitor deleted the fix-89875 branch October 27, 2021 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE with asm macro
7 participants