Uh oh!
There was an error while loading. Please reload this page.
compiler: Use LLVM's Comdat support - #131876
Conversation
rustbot
commented
Oct 18, 2024
Some changes occurred in coverage instrumentation. cc @Zalathar |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
rustbot
commented
Oct 18, 2024
These commits modify compiler targets. |
workingjubilee
commented
Oct 18, 2024
They really don't they just touch the public API... |
Uh oh!
There was an error while loading. Please reload this page.
Zalathar
commented
Oct 19, 2024
Thanks. r=me after squishing the fixups. |
268a153 to
49bb96cCompareZalathar
commented
Oct 19, 2024
@bors r+ |
bors
commented
Oct 19, 2024
| extern "C" void LLVMRustSetComdat(LLVMModuleRef M, LLVMValueRef V, | ||
| const char *Name, size_t NameLen) { | ||
| Triple TargetTriple = Triple(unwrap(M)->getTargetTriple()); | ||
| GlobalObject *GV = unwrap<GlobalObject>(V); | ||
| if (TargetTriple.supportsCOMDAT()) { | ||
| StringRef NameRef(Name, NameLen); | ||
| GV->setComdat(unwrap(M)->getOrInsertComdat(NameRef)); | ||
| } | ||
| } |
There was a problem hiding this comment.
afaict the LLVM-C API doesn't have an exact match of the support check we do here, which is why I implemented it via Rust. I'll go fix that.
…r=Zalathar compiler: Use LLVM's Comdat support Acting on these long-ago issues: - rust-lang#46437 - rust-lang#68955
…kingjubilee Rollup of 8 pull requests Successful merges: - rust-lang#127462 (std: uefi: Add basic Env variables) - rust-lang#131537 (Fix range misleading field access) - rust-lang#131838 (bootstrap: allow setting `--jobs` in config.toml) - rust-lang#131871 (x86-32 float return for 'Rust' ABI: treat all float types consistently) - rust-lang#131876 (compiler: Use LLVM's Comdat support) - rust-lang#131890 (Update `use` keyword docs to describe precise capturing) - rust-lang#131899 (Mark unexpected variant res suggestion as having placeholders) - rust-lang#131908 (rustdoc: Switch from FxHash to sha256 for static file hashing.) r? `@ghost` `@rustbot` modify labels: rollup
…r=Zalathar compiler: Use LLVM's Comdat support Acting on these long-ago issues: - rust-lang#46437 - rust-lang#68955
…iaskrgr Rollup of 10 pull requests Successful merges: - rust-lang#127462 (std: uefi: Add basic Env variables) - rust-lang#131537 (Fix range misleading field access) - rust-lang#131838 (bootstrap: allow setting `--jobs` in config.toml) - rust-lang#131871 (x86-32 float return for 'Rust' ABI: treat all float types consistently) - rust-lang#131876 (compiler: Use LLVM's Comdat support) - rust-lang#131890 (Update `use` keyword docs to describe precise capturing) - rust-lang#131899 (Mark unexpected variant res suggestion as having placeholders) - rust-lang#131908 (rustdoc: Switch from FxHash to sha256 for static file hashing.) - rust-lang#131916 (small interpreter error cleanup) - rust-lang#131919 (zero-sized accesses are fine on null pointers) r? `@ghost` `@rustbot` modify labels: rollup
matthiaskrgr
commented
Oct 19, 2024
| let name_buf = get_value_name(val).to_vec(); | ||
| let name = | ||
| CString::from_vec_with_nul(name_buf).or_else(|buf| CString::new(buf.into_bytes())).unwrap(); | ||
| set_comdat(llmod, val, &name); |
There was a problem hiding this comment.
Oh, looks like we need the supports-comdat check here too.
Or maybe this is a sign that the check should be inside set_comdat instead?
There was a problem hiding this comment.
Isn't this because !self.is_like_aix && !self.is_like_osx should be !self.is_like_aix || !self.is_like_osx?
No.
There was a problem hiding this comment.
I mean it's really a sign that "setting a comdat" needs to be a function on the CodegenCx, imo, where we already have acquired all the info, so that it isn't called when we don't have access to that.
There was a problem hiding this comment.
Yeah, that makes sense. Happy to leave that for future work.
Migrate `llvm::set_comdat` and `llvm::SetUniqueComdat` to LLVM-C FFI. Note, now we can call `llvm::set_comdat` only when the target actually supports adding comdat. As this has no convenient LLVM-C API, we implement this as `TargetOptions::supports_comdat`. Co-authored-by: Stuart Cook <Zalathar@users.noreply.github.com>
49bb96c to
4927600CompareZalathar
commented
Oct 20, 2024
This succeeded in @bors r+ |
bors
commented
Oct 20, 2024
Rollup of 4 pull requests Successful merges: - rust-lang#131876 (compiler: Use LLVM's Comdat support) - rust-lang#131941 (compiletest: disambiguate html-tidy from rust tidy tool) - rust-lang#131942 (compiler: Adopt rust-analyzer impls for `LayoutCalculatorError`) - rust-lang#131945 (rustdoc: Clean up footnote handling) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#131876 - workingjubilee:llvm-c-c-c-comdat, r=Zalathar compiler: Use LLVM's Comdat support Acting on these long-ago issues: - rust-lang#46437 - rust-lang#68955
bors
commented
Oct 20, 2024
…nem,workingjubilee Make `llvm::set_section` take a `&CStr` There's no reason to convert the section name to an intermediate `String`, when the LLVM-C API wants a C string anyway. Follow-up to rust-lang#131876.
…nem,workingjubilee Make `llvm::set_section` take a `&CStr` There's no reason to convert the section name to an intermediate `String`, when the LLVM-C API wants a C string anyway. Follow-up to rust-lang#131876.
Rollup merge of rust-lang#131962 - Zalathar:llvm-set-section, r=Swatinem,workingjubilee Make `llvm::set_section` take a `&CStr` There's no reason to convert the section name to an intermediate `String`, when the LLVM-C API wants a C string anyway. Follow-up to rust-lang#131876.
Acting on these long-ago issues:
r? @Zalathar