Skip to content

Instruction does not dominate all uses #117331

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
tmiasko opened this issue Oct 28, 2023 · 0 comments · Fixed by #117359
Closed

Instruction does not dominate all uses #117331

tmiasko opened this issue Oct 28, 2023 · 0 comments · Fixed by #117359
Labels
A-codegen Area: Code generation C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@tmiasko
Copy link
Contributor

tmiasko commented Oct 28, 2023

The following code (the custom mir syntax is provisional):

#![feature(custom_mir, core_intrinsics)]
use core::intrinsics::mir::*;
#[custom_mir(dialect = "runtime", phase = "optimized")]
pub fn f() -> u32 {
    mir!(
        let a: u32;
        {
            Call(a = f(), bb1, Cleanup(bb2))
        }
        bb1 = {
            RET = a;
            Return()
        }
        bb2 (cleanup) = {
            RET = a;
            Resume()
        }
    )
}

Generates invalid LLVM IR, because code generation incorrectly assumes a is defined when f unwinds:

Instruction does not dominate all uses!
  %3 = invoke i32 @_ZN1a1f17h84769ced50b3359cE()
          to label %16 unwind label %10
  store i32 %3, ptr %2, align 4
in function _ZN1a1f17h84769ced50b3359cE
LLVM ERROR: Broken function found, compilation aborted!
@tmiasko tmiasko added A-codegen Area: Code generation C-bug Category: This is a bug. labels Oct 28, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 28, 2023
@tmiasko tmiasko removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 28, 2023
@tmiasko tmiasko self-assigned this Oct 28, 2023
@Noratrieb Noratrieb added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Oct 29, 2023
bors added a commit to rust-lang-ci/rust that referenced this issue Nov 14, 2023
bors added a commit to rust-lang-ci/rust that referenced this issue Nov 15, 2023
@bors bors closed this as completed in 6d069a0 Nov 15, 2023
@tmiasko tmiasko removed their assignment Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants