-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Fix emitting asm and object file output at the same time #29385
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
@@ -244,11 +245,17 @@ LLVMRustWriteOutputFile(LLVMTargetMachineRef Target, | |||
return false; | |||
} | |||
|
|||
// Use a pass ID that doesn't identify any pass, so all the codegen passes | |||
// are skipped. This lets us output both asm and obj files from the same LLVM | |||
// module in a single run. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you expand this comment a bit to explain why this is here at all?
Could a run-pass test also be added to ensure this doesn't regress? |
The LLVM function to output file types that involve codegen can invalidate the IR while lowering. That means that the second time the IR is fed to those passes, it's invalid and the LLVM verifier complains. To workaround this, we can tell the function to skip the codegen passes the second time around. To do this, we tell it to start adding passes only after it has seen a pass that doesn't exist at all. Quite the hack, I know... Fixes rust-lang#24876
Updated |
⌛ Testing commit b90aa66 with merge 1d5948b... |
💔 Test failed - auto-win-gnu-32-nopt-t |
Closing due to inactivity, but feel free to resubmit! (r=me if so) |
The LLVM function to output file types that involve codegen can
invalidate the IR while lowering. That means that the second time the IR
is fed to those passes, it's invalid and the LLVM verifier complains. To
workaround this, we can tell the function to skip the codegen passes the
second time around. To do this, we tell it to start adding passes only
after it has seen a pass that doesn't exist at all. Quite the hack, I
know...
Fixes #24876