-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Pass arguments up to 2*usize by value #79547
Conversation
pub union UnionU128x2{a:(u128, u128)} | ||
// CHECK: define void @test_UnionU128x2(i128 %_1.0, i128 %_1.1) | ||
#[no_mangle] | ||
pub fn test_UnionU128x2(_: UnionU128x2) { loop {} } | ||
|
||
#[repr(C)] | ||
pub union CUnionU128{a:u128} | ||
// CHECK: define void @test_CUnionU128(%CUnionU128* {{.*}} %_1) | ||
pub union CUnionU128x2{a:(u128, u128)} | ||
// CHECK: define void @test_CUnionU128x2(%CUnionU128x2* {{.*}} %_1) | ||
#[no_mangle] | ||
pub fn test_CUnionU128(_: CUnionU128) { loop {} } | ||
pub fn test_CUnionU128x2(_: CUnionU128x2) { loop {} } |
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.
This was testing that single-field #[repr(C)]
unions don't forward that field's ABI, but after this change CUnionU128
would get passed by value, making it impossible to distinguish between i128
[forwarded from inner field] vs i128
[passing entire union by value]. So I had to make it bigger.
@bors try @rust-timer queue |
Awaiting bors try build completion |
⌛ Trying commit 0183b41 with merge 6b84c5f481a691b1da945054fe9c6311fca322dd... |
☀️ Try build successful - checks-actions |
Queued 6b84c5f481a691b1da945054fe9c6311fca322dd with parent 349b3b3, future comparison URL. |
Finished benchmarking try commit (6b84c5f481a691b1da945054fe9c6311fca322dd): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
@bors r+ |
📌 Commit 53943d6 has been approved by |
☀️ Test successful - checks-actions |
In #77434 (comment), @eddyb said:
Let's do a perf run and find out.
It seems the
extern "C"
ABI will pass arguments up to 2*usize in registers: https://godbolt.org/z/n8E6zc. (modified from #26494 (comment))r? @nagisa