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

Break critical edges in inline asm before code generation #138073

Merged
merged 3 commits into from
Mar 7, 2025

Conversation

tmiasko
Copy link
Contributor

@tmiasko tmiasko commented Mar 5, 2025

An inline asm terminator defines outputs along its target edges -- a
fallthrough target and labeled targets. Code generation implements this
by inserting code directly into the target blocks. This approach works
only if the target blocks don't have other predecessors.

Establish required invariant by extending existing code that breaks
critical edges before code generation.

Fixes #137867.

r? @bjorn3

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

rustbot commented Mar 5, 2025

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@tmiasko tmiasko force-pushed the inline-asm-critical-edges branch from a8fd9f4 to eb57356 Compare March 6, 2025 14:15
@bjorn3
Copy link
Member

bjorn3 commented Mar 6, 2025

r=me with the comment clarified.

tmiasko added 2 commits March 6, 2025 20:00
An inline asm terminator defines outputs along its target edges -- a
fallthrough target and labeled targets. Code generation implements this
by inserting code directly into the target blocks. This approach works
only if the target blocks don't have other predecessors.

Establish required invariant by extending existing code that breaks
critical edges before code generation.
@tmiasko tmiasko force-pushed the inline-asm-critical-edges branch from eb57356 to 02d7fc1 Compare March 6, 2025 19:03
@bjorn3
Copy link
Member

bjorn3 commented Mar 6, 2025

@bors r+

@bors
Copy link
Contributor

bors commented Mar 6, 2025

📌 Commit 02d7fc1 has been approved by bjorn3

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 Mar 6, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 7, 2025
… r=bjorn3

Break critical edges in inline asm before code generation

An inline asm terminator defines outputs along its target edges -- a
fallthrough target and labeled targets. Code generation implements this
by inserting code directly into the target blocks. This approach works
only if the target blocks don't have other predecessors.

Establish required invariant by extending existing code that breaks
critical edges before code generation.

Fixes rust-lang#137867.

r? `@bjorn3`
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 7, 2025
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#137674 (Enable `f16` for LoongArch)
 - rust-lang#138034 (library: Use `size_of` from the prelude instead of imported)
 - rust-lang#138060 (Revert rust-lang#138019 after further discussion about how hir-pretty printing should work)
 - rust-lang#138073 (Break critical edges in inline asm before code generation)
 - rust-lang#138107 (`librustdoc`: clippy fixes)
 - rust-lang#138111 (Use `default_field_values` for `rustc_errors::Context`, `rustc_session::config::NextSolverConfig` and `rustc_session::config::ErrorOutputType`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 1155f01 into rust-lang:master Mar 7, 2025
6 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Mar 7, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 7, 2025
Rollup merge of rust-lang#138073 - tmiasko:inline-asm-critical-edges, r=bjorn3

Break critical edges in inline asm before code generation

An inline asm terminator defines outputs along its target edges -- a
fallthrough target and labeled targets. Code generation implements this
by inserting code directly into the target blocks. This approach works
only if the target blocks don't have other predecessors.

Establish required invariant by extending existing code that breaks
critical edges before code generation.

Fixes rust-lang#137867.

r? ``@bjorn3``
@tmiasko tmiasko deleted the inline-asm-critical-edges branch March 7, 2025 17:15
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

asm_goto_with_outputs miscompilation
4 participants