1 // compile-flags: -C no-prepopulate-passes
2 // ignore-tidy-linelength
6 // Below, these constants are defined as enum variants that by itself would
7 // have a lower alignment than the enum type. Ensure that we mark them
8 // correctly with the higher alignment of the enum.
10 // CHECK: @STATIC = {{.*}}, align 4
12 // This checks the constants from inline_enum_const
13 // CHECK: @alloc5 = {{.*}}, align 2
15 // This checks the constants from {low,high}_align_const, they share the same
16 // constant, but the alignment differs, so the higher one should be used
17 // CHECK: [[LOW_HIGH:@[0-9]+]] = {{.*}} getelementptr inbounds (<{ [8 x i8] }>, <{ [8 x i8] }>* @alloc15, i32 0, i32 0, i32 0), {{.*}}
19 #[derive(Copy, Clone)]
20 // repr(i16) is required for the {low,high}_align_const test
28 pub static STATIC: E<i16, i32> = E::A(0);
30 // CHECK-LABEL: @static_enum_const
32 pub fn static_enum_const() -> E<i16, i32> {
36 // CHECK-LABEL: @inline_enum_const
38 pub fn inline_enum_const() -> E<i8, i16> {
42 // CHECK-LABEL: @low_align_const
44 pub fn low_align_const() -> E<i16, [i16; 3]> {
45 // Check that low_align_const and high_align_const use the same constant
46 // CHECK: load %"E<i16, [i16; 3]>"*, %"E<i16, [i16; 3]>"** bitcast (<{ i8*, [0 x i8] }>* [[LOW_HIGH]] to %"E<i16, [i16; 3]>"**),
50 // CHECK-LABEL: @high_align_const
52 pub fn high_align_const() -> E<i16, i32> {
53 // Check that low_align_const and high_align_const use the same constant
54 // CHECK: load %"E<i16, i32>"*, %"E<i16, i32>"** bitcast (<{ i8*, [0 x i8] }>* [[LOW_HIGH]] to %"E<i16, i32>"**),