-
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
Use copy bound in atomic operations to generate simpler MIR #70088
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @sfackler (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
r? @rust-lang/compiler |
I was looking at this from the angle: what would it take for MIR transforms to optimize Extending this to intrinsics should work. I could add them with understanding that it would break generic code that uses them without similar bounds, like for example this one here (before changes). In a separate PR preferably. |
We could extend the #[inline(always, if_arg_is_const(order))] To get a poor man's version of partial specialization (after which you most often can properly inline). In general I'm fine with any kind of intrinsic wrapper just becoming |
N.B: It's only UB if the function is actually reached at runtime. |
But until we have a good example for a non- |
Well, yeah, I meant that using them to duplicate/"move out" a value is likely UB, not just having around the function definitions.
What I mean is an atomic load of e.g. a |
Heh, this is the sort of thing I was telling @wesleywiser we should compute instead of "inline costs" - conditions under which the function would become trivial. |
Add copy bound to atomic & numeric intrinsics Includes changes from #70088.
The changes here don't affect any public API (the other PR is more interesting in that respect). r? @eddyb |
@bors r+ |
📌 Commit af0d6fc 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 |
Use copy bound in atomic operations to generate simpler MIR
Rollup of 9 pull requests Successful merges: - #69036 (rustc: don't resolve Instances which would produce malformed shims.) - #69443 (tidy: Better license checks.) - #69814 (Smaller and more correct generator codegen) - #69929 (Regenerate tables for Unicode 13.0.0) - #69959 (std: Don't abort process when printing panics in tests) - #69969 (unix: Set a guard page at the end of signal stacks) - #70005 ([rustdoc] Improve visibility for code blocks warnings) - #70088 (Use copy bound in atomic operations to generate simpler MIR) - #70095 (Implement -Zlink-native-libraries) Failed merges: r? @ghost
Rollup of 9 pull requests Successful merges: - #68941 (Properly handle Spans that reference imported SourceFiles) - #69036 (rustc: don't resolve Instances which would produce malformed shims.) - #69443 (tidy: Better license checks.) - #69814 (Smaller and more correct generator codegen) - #69929 (Regenerate tables for Unicode 13.0.0) - #69959 (std: Don't abort process when printing panics in tests) - #69969 (unix: Set a guard page at the end of signal stacks) - #70005 ([rustdoc] Improve visibility for code blocks warnings) - #70088 (Use copy bound in atomic operations to generate simpler MIR) Failed merges: r? @ghost
No description provided.