-
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
Don't pass NoAlias
attribute for arguments passed by value
#115350
Conversation
r? @jackh726 (rustbot has picked a reviewer for you, use r? to override) |
Just in case: @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 32a8d75 with merge 17f23b92274eee4b3eba2dee1fff8264edf3d266... |
This seems to be missing test coverage. To clarify, this is just a stylistic change, right? Applying noalias to byval arguments should be safe, just redundant. |
// If the argument is passed by value, the `NoAlias` attribute should never be | ||
// applied. More information about this in: | ||
// * https://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20171218/512066.html | ||
// * https://reviews.llvm.org/D40118 | ||
attrs.unset(ArgAttribute::NoAlias); |
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.
The linked patch is unrelated to this change. The patch allows more noalias
when an argument aliases with a byval
argument, whereas this change is removing noalias
. (Also that patch is about noalias
applied to non-byval
arguments, whereas this change is for noalias
applied to byval
arguments...)
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.
Ah indeed, it links to callsite, not function args.
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.
That's not the distinction. noalias
has the same meaning whether it's applied on the callsite's argument or the function declaration's argument, and the code you're changing affects both.
To put it more simply:
- that patch is saying "noalias is okay in more places"
- your change, by removing
noalias
, is saying "noalias is okay in fewer places"
Now, this isn't a direct contradiction, since they're also talking about different situations. 🙃 It's just unrelated.
It's redundant inside the callee for sure, but is it redundant in the caller? Couldn't AA use a call to |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
I have no clue what to test here. Just that the ASM generated is the same?
Normally it shouldn't change anything as LLVM seems to correctly handle this case internally unlike GCC. |
A test for this would be that
Can you elaborate on this? I can think of two possible meanings:
|
Sounds good to me.
I meant:
|
Okay, that's not the one I was expecting 😁 I don't understand why you're making this change then. If the motivation is that GCC is incompatible with this attribute, then the GCC backend should ignore it, as you've already done in rust-lang/rustc_codegen_gcc#312. It doesn't make sense to remove it entirely from all backends, as this PR does, unless it's actually wrong to specify it. (Which I don't think is the case.) |
I didn't take into account the callsite so I think it's better to just close this PR and continue to handle it directly in cg_gcc. Thanks for the review! |
Finished benchmarking commit (17f23b92274eee4b3eba2dee1fff8264edf3d266): 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. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 630.431s -> 632.095s (0.26%) |
We found out about this in rust-lang/rustc_codegen_gcc#312.
You can find more information about this in: