1
1
// GVN may create indirect constants with higher alignment than their type requires. Verify that we
2
2
// do not ICE during codegen, and that the LLVM constant has the higher alignment.
3
3
//
4
- // compile-flags: -O -Zmir-enable-passes=+GVN -Cdebuginfo=2
4
+ // compile-flags: -Zmir-opt-level=0 -Zmir-enable-passes=+GVN
5
5
// compile-flags: -Cno-prepopulate-passes
6
6
// only-64bit
7
7
8
8
struct S ( i32 ) ;
9
9
10
10
struct SmallStruct ( f32 , Option < S > , & ' static [ f32 ] ) ;
11
11
12
+ // CHECK: @0 = private unnamed_addr constant
13
+ // CHECK-SAME: , align 8
14
+
12
15
fn main ( ) {
16
+ // CHECK-LABEL: @_ZN20overaligned_constant4main
17
+ // CHECK: [[full:%_.*]] = alloca %SmallStruct, align 8
18
+ // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[full]], ptr align 8 @0, i64 32, i1 false)
19
+ // CHECK: %b.0 = load i32, ptr @0, align 4,
20
+ // CHECK: %b.1 = load i32, ptr getelementptr inbounds ({ i32, i32 }, ptr @0, i32 0, i32 1), align 4
13
21
let mut s = S ( 1 ) ;
14
22
15
23
s. 0 = 3 ;
@@ -26,6 +34,3 @@ fn main() {
26
34
// alignment 8, but only use the `Option<S>` field, at offset 0 with alignment 4.
27
35
let SmallStruct ( a, b, c) = SMALL_VAL ;
28
36
}
29
-
30
- // CHECK: @0 = private unnamed_addr constant
31
- // CHECK-SAME: , align 8
0 commit comments