-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add -Zmutable-noalias flag #45012
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 -Zmutable-noalias flag #45012
Conversation
r? @arielb1 (rust_highfive has picked a reviewer for you, use r? to override) |
cc @jrmuizel |
Some codgen tests using serde: code
make_bytes
make_bytes -Zmutable-noalias
Changing Entity to be make_bytes
make_bytes -Zmutable-noalias
slow_make_bytes (uniform, but generally unaffected by any change)
This significantly improves our codegen. |
This is very interesting. Kudos for running tests 😄 |
Anywhere you see SetLenOnDrop inside the vec code, it's probably a workaround for the missing noalias. |
@bors r+ |
📌 Commit 3647129 has been approved by |
@arielb1 what's the legislative process for promoting this to a -C flag? (e.g. usable on stable) |
Should this become a |
That's basically https://forge.rust-lang.org/stabilization-guide.html - create a tracking issue, nominate it to T-compiler FCP, write docs. But I don't think we want this to be a |
@rkruppe it might be reasonable to default if panic=abort, but idk yet about otherwise. |
Are you talking about lingering misoptimizations? Surely if those exist, end users shouldn't be encouraged to enable it? |
Based on discussion in #45029, I've added a commit to enable this by default if |
Let's have a go at this @bors r+ |
📌 Commit a6dea41 has been approved by |
This is the same mode as Gecko uses and will get better codegen once rust-lang/rust#45012 has landed.
Do we have some benchmarks? Would love to know if this has significant effect on |
Add -Zmutable-noalias flag We disabled noalias on mutable references a long time ago when it was clear that llvm was incorrectly handling this in relation to unwinding edges. Since then, a few things have happened: * llvm has cleaned up a bunch of the issues (I'm told) * we've added a nounwind codegen option As such, I would like to add this -Z flag so that we can evaluate if the codegen bugs still exist, and if this significantly affects the codegen of different projects, with an eye towards permanently re-enabling it (or at least making it a stable option).
☀️ Test successful - status-appveyor, status-travis |
There's a "null result" with this option in bluss/arrayvec#74 (but I wouldn't know if it definitely should apply there anyway). I'll run some more benchmarks when I can. |
Use panic=abort instead of panic=unwind This is the same mode as Gecko uses and will get better codegen once rust-lang/rust#45012 has landed. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/1825) <!-- Reviewable:end -->
We disabled noalias on mutable references a long time ago when it was clear that llvm was incorrectly handling this in relation to unwinding edges.
Since then, a few things have happened:
As such, I would like to add this -Z flag so that we can evaluate if the codegen bugs still exist, and if this significantly affects the codegen of different projects, with an eye towards permanently re-enabling it (or at least making it a stable option).