-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Use module inline assembly to embed bitcode #91654
Conversation
In LLVM 14, our current method of setting section flags to avoid embedding the `.llvmbc` section into final compilation artifacts will no longer work, see issue rust-lang#90326. The upstream recommendation is to instead embed the entire bitcode using module-level inline assembly, which is what this change does. I've kept the existing code for platforms where we do not need to set section flags, but possibly we should always be using the inline asm approach.
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 509dedc with merge b31c835a9b55c5a2bd18906c03f20e05012b491e... |
☀️ Try build successful - checks-actions |
Queued b31c835a9b55c5a2bd18906c03f20e05012b491e with parent abba5ed, future comparison URL. |
Finished benchmarking commit (b31c835a9b55c5a2bd18906c03f20e05012b491e): comparison url. Summary: This change led to large relevant regressions 😿 in compiler performance.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR led to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never |
if byte == b'\\' || byte == b'"' { | ||
asm.push(b'\\'); | ||
asm.push(byte); | ||
} else if byte < 0x20 || byte >= 0x80 { |
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.
To be honest, I'm somewhat more comfortable with a .byte
directive over .ascii
with escapes here. Is there any particular reason why we'd be stuck with .ascii
?
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.
.byte
should work as well. I picked .ascii
here for more compact encoding. Though I guess .byte
isn't so bad when using decimal rather than hex and saving on the 0x
prefix for each byte.
To the best of my knowledge the perf run results are quite irrelevant here, aren't they? Since we only ever embed bitcode by default on iOS targets. |
@bors r+ |
📌 Commit 509dedc has been approved by |
We also embed bitcode in some LTO scenarios (in particular for libstd, which must be usable with and without LTO), though I'm not sure which flag exactly controls that. I suspect the html5-ever incremental regression may be another instance of rust-lang/rustc-perf#1105 though, as it doesn't seem to be using any (cross-crate) LTO. |
See here: Lines 332 to 342 in 11fb21f
|
☀️ Test successful - checks-actions |
Finished benchmarking commit (a737592): comparison url. Summary: This benchmark run did not return any relevant changes. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
In LLVM 14, our current method of setting section flags to avoid
embedding the
.llvmbc
section into final compilation artifactswill no longer work, see issue #90326. The upstream recommendation
is to instead embed the entire bitcode using module-level inline
assembly, which is what this change does.
I've kept the existing code for platforms where we do not need to
set section flags, but possibly we should always be using the
inline asm approach (which would have to look a bit different for MachO).
r? @nagisa