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

lto: load bitcode sections by name #115641

Merged
merged 2 commits into from
Sep 8, 2023
Merged

Conversation

durin42
Copy link
Contributor

@durin42 durin42 commented Sep 7, 2023

Upstream change
llvm/llvm-project@6b539f5 changed isSectionBitcode works and it now only respects .llvm.lto sections instead of also .llvmbc, which it says was never intended to be used for LTO. We instead load sections by name, and sniff for raw bitcode by hand.

This is an alternative approach to #115136, where we tried the same thing using the object crate, but it got too fraught to continue.

r? @nikic
@rustbot label: +llvm-main

Upstream change
llvm/llvm-project@6b539f5 changed
`isSectionBitcode` works and it now only respects `.llvm.lto` sections
instead of also `.llvmbc`, which it says was never intended to be used
for LTO. We instead load sections by name, and sniff for raw bitcode by
hand.

r? @nikic
@rustbot label: +llvm-main
@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. llvm-main Marks PRs that are making Rust work with LLVM main (this label is consumed by CI tooling) labels Sep 7, 2023
@durin42
Copy link
Contributor Author

durin42 commented Sep 7, 2023

This is broken for me on macOS (M1, presumably also x86 but that machine is so slow to compile I didn't bother testing there). We look for __LLVM,__bitcode on macOS, but when I iterate the sections I see __text, __gcc_except_tab, __const, __const, __bitcode, __cmdline, __compact_unwind, __eh_frame. Should we be using __bitcode?

@durin42
Copy link
Contributor Author

durin42 commented Sep 7, 2023

Looking, it looks like the __LLVM prefix here is the "segment name" in the macho file, which is a concept unique to that format. I guess for this use case we'll detect-and-elide the __LLVM, prefix and that'll work for now, even if it's gross.

@nikic
Copy link
Contributor

nikic commented Sep 7, 2023

@bors r+

@bors
Copy link
Collaborator

bors commented Sep 7, 2023

📌 Commit 0db6602 has been approved by nikic

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 Sep 7, 2023
@bors
Copy link
Collaborator

bors commented Sep 8, 2023

⌛ Testing commit 0db6602 with merge ffc48e3...

@bors
Copy link
Collaborator

bors commented Sep 8, 2023

☀️ Test successful - checks-actions
Approved by: nikic
Pushing ffc48e3 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 8, 2023
@bors bors merged commit ffc48e3 into rust-lang:master Sep 8, 2023
@rustbot rustbot added this to the 1.74.0 milestone Sep 8, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ffc48e3): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.0% [2.0%, 2.0%] 1
Regressions ❌
(secondary)
1.9% [1.3%, 2.5%] 9
Improvements ✅
(primary)
-2.1% [-2.1%, -2.1%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.0% [-2.1%, 2.0%] 2

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.1% [-3.1%, -3.1%] 1
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 627.243s -> 630.375s (0.50%)
Artifact size: 318.06 MiB -> 318.12 MiB (0.02%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llvm-main Marks PRs that are making Rust work with LLVM main (this label is consumed by CI tooling) merged-by-bors This PR was explicitly merged by bors. 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.

5 participants