Skip to content

Commit 503af0d

Browse files
committed
Fortify test.
1 parent 3ea5cfa commit 503af0d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

tests/codegen/overaligned-constant.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
// GVN may create indirect constants with higher alignment than their type requires. Verify that we
22
// do not ICE during codegen, and that the LLVM constant has the higher alignment.
33
//
4-
// compile-flags: -O -Zmir-enable-passes=+GVN -Cdebuginfo=2
4+
// compile-flags: -Zmir-opt-level=0 -Zmir-enable-passes=+GVN
55
// compile-flags: -Cno-prepopulate-passes
66
// only-64bit
77

88
struct S(i32);
99

1010
struct SmallStruct(f32, Option<S>, &'static [f32]);
1111

12+
// CHECK: @0 = private unnamed_addr constant
13+
// CHECK-SAME: , align 8
14+
1215
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
1321
let mut s = S(1);
1422

1523
s.0 = 3;
@@ -26,6 +34,3 @@ fn main() {
2634
// alignment 8, but only use the `Option<S>` field, at offset 0 with alignment 4.
2735
let SmallStruct(a, b, c) = SMALL_VAL;
2836
}
29-
30-
// CHECK: @0 = private unnamed_addr constant
31-
// CHECK-SAME: , align 8

0 commit comments

Comments
 (0)