-
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
do not add noalias in return position #106371
Conversation
r? @jackh726 (rustbot has picked a reviewer for you, use r? to override) |
I think this is the right thing to do, and I intuitively wouldn't expect this to have a huge impact, because we still have noalias on the @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit e7cad62 with merge 4921783924d104b60b4219521643e1d57e96d94e... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (4921783924d104b60b4219521643e1d57e96d94e): comparison URL. Overall result: no relevant changes - no action neededBenchmarking 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 may lead to changes in compiler perf. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis 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.
CyclesThis benchmark run did not return any relevant results for this metric. |
Okay, that was a pretty clear answer... @bors r+ |
☀️ Test successful - checks-actions |
Finished benchmarking commit (442f997): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis 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.
CyclesThis benchmark run did not return any relevant results for this metric. |
…nikic do not add noalias in return position `noalias` as a return attribute in LLVM indicates that the returned pointer does not alias anything else that is reachable from the caller, *including things reachable before this function call*. This is clearly not the case with a function like `fn id(Box<T>) -> Box<T>`, so we cannot use this attribute. Fixes rust-lang/unsafe-code-guidelines#385 (including an actual miscompilation that `@comex` managed to produce).
I am now curious: We briefly touched on this PR (#106371) while discussing rust-lang/unsafe-code-guidelines#196, and I cannot immediately tell from a cursory look: Did this change end up removing @RalfJung said in the meeting that they believed we are still emitting ((I now also see there was significant discussion of the original motivations for return-position |
|
I believe I broke applying this attribute for |
noalias
as a return attribute in LLVM indicates that the returned pointer does not alias anything else that is reachable from the caller, including things reachable before this function call. This is clearly not the case with a function likefn id(Box<T>) -> Box<T>
, so we cannot use this attribute.Fixes rust-lang/unsafe-code-guidelines#385 (including an actual miscompilation that @comex managed to produce).