2022-12-30 14:11:30 -06:00
|
|
|
// compile-flags: -C no-prepopulate-passes -Copt-level=0
|
2020-08-16 18:24:59 -05:00
|
|
|
|
|
|
|
// Test that tuples get optimized layout, in particular with a ZST in the last field (#63244)
|
|
|
|
|
|
|
|
#![crate_type="lib"]
|
|
|
|
|
|
|
|
type ScalarZstLast = (u128, ());
|
2023-05-23 08:26:31 -05:00
|
|
|
// CHECK: define {{(dso_local )?}}i128 @test_ScalarZstLast(i128 %_1)
|
2020-08-16 18:24:59 -05:00
|
|
|
#[no_mangle]
|
|
|
|
pub fn test_ScalarZstLast(_: ScalarZstLast) -> ScalarZstLast { loop {} }
|
|
|
|
|
|
|
|
type ScalarZstFirst = ((), u128);
|
2023-05-23 08:26:31 -05:00
|
|
|
// CHECK: define {{(dso_local )?}}i128 @test_ScalarZstFirst(i128 %_1)
|
2020-08-16 18:24:59 -05:00
|
|
|
#[no_mangle]
|
|
|
|
pub fn test_ScalarZstFirst(_: ScalarZstFirst) -> ScalarZstFirst { loop {} }
|
|
|
|
|
|
|
|
type ScalarPairZstLast = (u8, u128, ());
|
2023-05-23 08:26:31 -05:00
|
|
|
// CHECK: define {{(dso_local )?}}{ i128, i8 } @test_ScalarPairZstLast(i128 %_1.0, i8 %_1.1)
|
2020-08-16 18:24:59 -05:00
|
|
|
#[no_mangle]
|
|
|
|
pub fn test_ScalarPairZstLast(_: ScalarPairZstLast) -> ScalarPairZstLast { loop {} }
|
|
|
|
|
|
|
|
type ScalarPairZstFirst = ((), u8, u128);
|
2023-05-23 08:26:31 -05:00
|
|
|
// CHECK: define {{(dso_local )?}}{ i8, i128 } @test_ScalarPairZstFirst(i8 %_1.0, i128 %_1.1)
|
2020-08-16 18:24:59 -05:00
|
|
|
#[no_mangle]
|
|
|
|
pub fn test_ScalarPairZstFirst(_: ScalarPairZstFirst) -> ScalarPairZstFirst { loop {} }
|
|
|
|
|
|
|
|
type ScalarPairLotsOfZsts = ((), u8, (), u128, ());
|
2023-05-23 08:26:31 -05:00
|
|
|
// CHECK: define {{(dso_local )?}}{ i128, i8 } @test_ScalarPairLotsOfZsts(i128 %_1.0, i8 %_1.1)
|
2020-08-16 18:24:59 -05:00
|
|
|
#[no_mangle]
|
|
|
|
pub fn test_ScalarPairLotsOfZsts(_: ScalarPairLotsOfZsts) -> ScalarPairLotsOfZsts { loop {} }
|
|
|
|
|
|
|
|
type ScalarPairLottaNesting = (((), ((), u8, (), u128, ())), ());
|
2023-05-23 08:26:31 -05:00
|
|
|
// CHECK: define {{(dso_local )?}}{ i128, i8 } @test_ScalarPairLottaNesting(i128 %_1.0, i8 %_1.1)
|
2020-08-16 18:24:59 -05:00
|
|
|
#[no_mangle]
|
|
|
|
pub fn test_ScalarPairLottaNesting(_: ScalarPairLottaNesting) -> ScalarPairLottaNesting { loop {} }
|