Fortify test.
This commit is contained in:
parent
3ea5cfaa11
commit
503af0deb2
@ -1,7 +1,7 @@
|
|||||||
// GVN may create indirect constants with higher alignment than their type requires. Verify that we
|
// GVN may create indirect constants with higher alignment than their type requires. Verify that we
|
||||||
// do not ICE during codegen, and that the LLVM constant has the higher alignment.
|
// do not ICE during codegen, and that the LLVM constant has the higher alignment.
|
||||||
//
|
//
|
||||||
// compile-flags: -O -Zmir-enable-passes=+GVN -Cdebuginfo=2
|
// compile-flags: -Zmir-opt-level=0 -Zmir-enable-passes=+GVN
|
||||||
// compile-flags: -Cno-prepopulate-passes
|
// compile-flags: -Cno-prepopulate-passes
|
||||||
// only-64bit
|
// only-64bit
|
||||||
|
|
||||||
@ -9,7 +9,15 @@ struct S(i32);
|
|||||||
|
|
||||||
struct SmallStruct(f32, Option<S>, &'static [f32]);
|
struct SmallStruct(f32, Option<S>, &'static [f32]);
|
||||||
|
|
||||||
|
// CHECK: @0 = private unnamed_addr constant
|
||||||
|
// CHECK-SAME: , align 8
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
// CHECK-LABEL: @_ZN20overaligned_constant4main
|
||||||
|
// CHECK: [[full:%_.*]] = alloca %SmallStruct, align 8
|
||||||
|
// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[full]], ptr align 8 @0, i64 32, i1 false)
|
||||||
|
// CHECK: %b.0 = load i32, ptr @0, align 4,
|
||||||
|
// CHECK: %b.1 = load i32, ptr getelementptr inbounds ({ i32, i32 }, ptr @0, i32 0, i32 1), align 4
|
||||||
let mut s = S(1);
|
let mut s = S(1);
|
||||||
|
|
||||||
s.0 = 3;
|
s.0 = 3;
|
||||||
@ -26,6 +34,3 @@ fn main() {
|
|||||||
// alignment 8, but only use the `Option<S>` field, at offset 0 with alignment 4.
|
// alignment 8, but only use the `Option<S>` field, at offset 0 with alignment 4.
|
||||||
let SmallStruct(a, b, c) = SMALL_VAL;
|
let SmallStruct(a, b, c) = SMALL_VAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK: @0 = private unnamed_addr constant
|
|
||||||
// CHECK-SAME: , align 8
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user