-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Forward the ABI of the non-zero sized fields of an union if they have…
… the same ABI This is supposed to fix the performence regression of using MaybeUninit in #54668
- Loading branch information
commit 562be7e1a1955742d61320d0855550794c4b6c22
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// compile-flags: -C no-prepopulate-passes | ||
|
||
// This test that using union forward the abi of the inner type, as | ||
// discussed in #54668 | ||
|
||
#![crate_type="lib"] | ||
#![feature(repr_simd)] | ||
|
||
#[derive(Copy, Clone)] | ||
pub enum Unhab {} | ||
|
||
#[repr(simd)] | ||
#[derive(Copy, Clone)] | ||
pub struct i64x4(i64, i64, i64, i64); | ||
|
||
#[derive(Copy, Clone)] | ||
pub union UnionI64x4{ a:(), b: i64x4 } | ||
|
||
// CHECK: define <4 x i64> @test_UnionI64x4(<4 x i64> %arg0) | ||
#[no_mangle] | ||
pub extern fn test_UnionI64x4(_: UnionI64x4) -> UnionI64x4 { loop {} } | ||
|
||
pub union UnionI64x4_{ a: i64x4, b: (), c:i64x4, d: Unhab, e: ((),()), f: UnionI64x4 } | ||
|
||
// CHECK: define <4 x i64> @test_UnionI64x4_(<4 x i64> %arg0) | ||
#[no_mangle] | ||
pub extern fn test_UnionI64x4_(_: UnionI64x4_) -> UnionI64x4_ { loop {} } | ||
|
||
pub union UnionI64x4I64{ a: i64x4, b: i64 } | ||
|
||
// CHECK: define void @test_UnionI64x4I64(%UnionI64x4I64* {{.*}} %arg0) | ||
#[no_mangle] | ||
pub fn test_UnionI64x4I64(_: UnionI64x4I64) { loop {} } | ||
|
||
pub union UnionI64x4Tuple{ a: i64x4, b: (i64, i64, i64, i64) } | ||
|
||
// CHECK: define void @test_UnionI64x4Tuple(%UnionI64x4Tuple* {{.*}} %arg0) | ||
#[no_mangle] | ||
pub fn test_UnionI64x4Tuple(_: UnionI64x4Tuple) { loop {} } | ||
|
||
|
||
pub union UnionF32{a:f32} | ||
|
||
// CHECK: define float @test_UnionF32(float %arg0) | ||
#[no_mangle] | ||
pub extern fn test_UnionF32(_: UnionF32) -> UnionF32 { loop {} } | ||
|
||
pub union UnionF32F32{a:f32, b:f32} | ||
|
||
// CHECK: define float @test_UnionF32F32(float %arg0) | ||
#[no_mangle] | ||
pub extern fn test_UnionF32F32(_: UnionF32F32) -> UnionF32F32 { loop {} } | ||
|
||
pub union UnionF32U32{a:f32, b:u32} | ||
|
||
// CHECK: define i32 @test_UnionF32U32(i32) | ||
#[no_mangle] | ||
pub extern fn test_UnionF32U32(_: UnionF32U32) -> UnionF32U32 { loop {} } | ||
|
||
pub union UnionU128{a:u128} | ||
// CHECK: define i128 @test_UnionU128(i128 %arg0) | ||
#[no_mangle] | ||
pub fn test_UnionU128(_: UnionU128) -> UnionU128 { loop {} } | ||
|
||
#[repr(C)] | ||
pub union CUnionU128{a:u128} | ||
// CHECK: define void @test_CUnionU128(%CUnionU128* {{.*}} %arg0) | ||
#[no_mangle] | ||
pub fn test_CUnionU128(_: CUnionU128) { loop {} } | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Rollup of 25 pull requests #56051
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
Uh oh!
There was an error while loading. Please reload this page.
Rollup of 25 pull requests #56051
Changes from 1 commit
f3e9b1a
b7c319c
0671bdb
0c08529
562be7e
cfbae3e
57a7c85
2ec6f34
f6b8eb7
fb5135a
1ca505a
c040a48
b396505
aa3d7a4
a1f83e7
7f4bc22
6779bb4
c5bc83b
e4d03f8
62cf9ab
e6e5635
ffb6ba0
a3770c2
b8915f2
81303d7
346e976
2bb5029
4f9c860
8c8ff6a
03aaa4b
303dbcc
c1221e2
0c0478d
41434e0
a7b312f
25d46f3
2b7c3fb
8e13e43
5fc63ce
cdb1a79
a5b4cb2
36e1d9f
21ff709
9c3e8d3
4a52c56
7130947
9577734
3aeac24
131a755
c87c31b
5e2ff63
715d83f
8607325
fc30ab4
32e4eb9
989d06a
< 8000 div class="text-emphasized css-truncate css-truncate-target"> Rollup merge of #55953 - blitzerr:master, r=nikomatsakisf13d166
318a38e
6ecbb05
cc6473d
c0d48ce
05ae505
2a68c00
f5dc12e
27519c1
10565c4
8cea658
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.