-
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
Add support for storing code model to LLVM module IR #74002
Conversation
This patch avoids undefined behavior by linking different object files. Also this would it could be propagated properly to LTO. See https://reviews.llvm.org/D52322 and https://reviews.llvm.org/D52323.
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
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.
r? @nagisa
r=me after pub
→ crate
@@ -108,7 +108,7 @@ fn to_llvm_relocation_model(relocation_model: RelocModel) -> llvm::RelocModel { | |||
} | |||
} | |||
|
|||
fn to_llvm_code_model(code_model: Option<CodeModel>) -> llvm::CodeModel { | |||
pub fn to_llvm_code_model(code_model: Option<CodeModel>) -> llvm::CodeModel { |
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.
Consider pub(crate)
or just crate
.
src/rustllvm/PassWrapper.cpp
Outdated
// Linking object files with different code models is undefined behavior | ||
// because the compiler would have to generate additional code (to span | ||
// longer jumps) if a larger code model is used with a smaller one. | ||
// Therefore we will treat attempts to mix code models as an error. |
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.
This last sentence is super interesting, but it is not super clear where the "error" comes from. Does it happen at LTO time? Quick skim of the linked differentials does not answer it, you need to read the comments, so it would be great if more about this was said here.
I would also probably move it to this function’s call location as people are way more likely to read it in librustc_codegen_llvm
than here.
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.
This last sentence is super interesting, but it is not super clear where the "error" comes from. Does it happen at LTO time? Quick skim of the linked differentials does not answer it, you need to read the comments, so it would be great if more about this was said here.
Thank you for having a look, and sorry for not clear that.
I checked LLVM and IRMover works both link time and LTO time, so this happends either.However, this error won't happen at rustc comiple time, so I would just remove this line.
@bors r+ Thanks! |
📌 Commit 67a5e2b has been approved by |
Add support for storing code model to LLVM module IR This patch avoids undefined behavior by linking different object files. Also this would it could be propagated properly to LTO. See https://reviews.llvm.org/D52322 and https://reviews.llvm.org/D52323.
Failed in #74054 (comment), @bors r- |
CI shows:
|
What should I do next? |
📌 Commit 5c24a94 has been approved by |
🌲 The tree is currently closed for pull requests below priority 5, this pull request will be tested once the tree is reopened |
💡 This pull request was already approved, no need to approve it again.
|
📌 Commit 5c24a94 has been approved by |
@bors p=1 |
⌛ Testing commit 5c24a94 with merge 9d1583c098bad1b07f1ee7a2c168e8dd21f743e6... |
@bors retry yielding to high priority pr |
@bors rollup=never |
@bors p=0 |
Is this rollup=never because it has to be or because we expect it to perhaps fail a rollup? There's a new rollup=iffy for that |
Yeah it was @bors rollup=iffy |
Add support for storing code model to LLVM module IR This patch avoids undefined behavior by linking different object files. Also this would it could be propagated properly to LTO. See https://reviews.llvm.org/D52322 and https://reviews.llvm.org/D52323.
Expected so, wanted to confirm. Thanks! |
@kubo39 thanks for the effort but unfortunately I've to close this pr due to inactivity. If you wish and have figured out the failure pasted earlier, you can submit a new PR with the fix and we can get it reviewed. Thanks for taking the time to contribute. |
This patch avoids undefined behavior by linking different object files. Also this would it could be propagated properly to LTO. See https://reviews.llvm.org/D52322 and https://reviews.llvm.org/D52323. This patch is based on rust-lang#74002
Add support for storing code model to LLVM module IR This patch avoids undefined behavior by linking different object files. Also this would it could be propagated properly to LTO. See https://reviews.llvm.org/D52322 and https://reviews.llvm.org/D52323. This patch is based on rust-lang#74002
Add support for storing code model to LLVM module IR This patch avoids undefined behavior by linking different object files. Also this would it could be propagated properly to LTO. See https://reviews.llvm.org/D52322 and https://reviews.llvm.org/D52323. This patch is based on rust-lang#74002
This patch avoids undefined behavior by linking different object files.
Also this would it could be propagated properly to LTO.
See https://reviews.llvm.org/D52322 and https://reviews.llvm.org/D52323.