1 // compile-flags: -C no-prepopulate-passes
2 // ignore-tidy-linelength
3 // min-llvm-version 7.0
7 // Below, these constants are defined as enum variants that by itself would
8 // have a lower alignment than the enum type. Ensure that we mark them
9 // correctly with the higher alignment of the enum.
11 // CHECK: @STATIC = {{.*}}, align 4
13 // This checks the constants from inline_enum_const
14 // CHECK: @{{[0-9]+}} = {{.*}}, align 2
16 // This checks the constants from {low,high}_align_const, they share the same
17 // constant, but the alignment differs, so the higher one should be used
18 // CHECK: [[LOW_HIGH:@[0-9]+]] = {{.*}}, align 4
20 #[derive(Copy, Clone)]
22 // repr(i16) is required for the {low,high}_align_const test
30 pub static STATIC: E<i16, i32> = E::A(0);
32 // CHECK-LABEL: @static_enum_const
34 pub fn static_enum_const() -> E<i16, i32> {
38 // CHECK-LABEL: @inline_enum_const
40 pub fn inline_enum_const() -> E<i8, i16> {
44 // CHECK-LABEL: @low_align_const
46 pub fn low_align_const() -> E<i16, [i16; 3]> {
47 // Check that low_align_const and high_align_const use the same constant
48 // CHECK: i8* align 2 getelementptr inbounds (<{ [8 x i8] }>, <{ [8 x i8] }>* [[LOW_HIGH]], i32 0, i32 0, i32 0),
52 // CHECK-LABEL: @high_align_const
54 pub fn high_align_const() -> E<i16, i32> {
55 // Check that low_align_const and high_align_const use the same constant
56 // CHECK: i8* align 4 getelementptr inbounds (<{ [8 x i8] }>, <{ [8 x i8] }>* [[LOW_HIGH]], i32 0, i32 0, i32 0),