FileCheck intrinsic_asserts.
This commit is contained in:
parent
ddc328c2f1
commit
f856247cc9
@ -1,12 +0,0 @@
|
||||
// skip-filecheck
|
||||
// compile-flags: --crate-type=lib
|
||||
// unit-test: InstSimplify
|
||||
|
||||
#![feature(core_intrinsics)]
|
||||
|
||||
// Want to make sure this assertion isn't compiled away in generic code.
|
||||
|
||||
// EMIT_MIR dont_yeet_assert.generic.InstSimplify.diff
|
||||
pub fn generic<T>() {
|
||||
core::intrinsics::assert_mem_uninitialized_valid::<&T>();
|
||||
}
|
@ -8,25 +8,25 @@
|
||||
let _3: ();
|
||||
|
||||
bb0: {
|
||||
nop;
|
||||
StorageLive(_1);
|
||||
_1 = assert_inhabited::<T>() -> [return: bb1, unwind unreachable];
|
||||
}
|
||||
|
||||
bb1: {
|
||||
nop;
|
||||
nop;
|
||||
StorageDead(_1);
|
||||
StorageLive(_2);
|
||||
_2 = assert_zero_valid::<T>() -> [return: bb2, unwind unreachable];
|
||||
}
|
||||
|
||||
bb2: {
|
||||
nop;
|
||||
nop;
|
||||
StorageDead(_2);
|
||||
StorageLive(_3);
|
||||
_3 = assert_mem_uninitialized_valid::<T>() -> [return: bb3, unwind unreachable];
|
||||
}
|
||||
|
||||
bb3: {
|
||||
nop;
|
||||
nop;
|
||||
StorageDead(_3);
|
||||
_0 = const ();
|
||||
return;
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
- // MIR for `generic` before InstSimplify
|
||||
+ // MIR for `generic` after InstSimplify
|
||||
- // MIR for `generic_ref` before InstSimplify
|
||||
+ // MIR for `generic_ref` after InstSimplify
|
||||
|
||||
fn generic() -> () {
|
||||
fn generic_ref() -> () {
|
||||
let mut _0: ();
|
||||
let _1: ();
|
||||
|
@ -8,28 +8,28 @@
|
||||
let _3: ();
|
||||
|
||||
bb0: {
|
||||
nop;
|
||||
StorageLive(_1);
|
||||
- _1 = assert_inhabited::<Never>() -> [return: bb1, unwind unreachable];
|
||||
+ _1 = assert_inhabited::<Never>() -> unwind unreachable;
|
||||
}
|
||||
|
||||
bb1: {
|
||||
nop;
|
||||
nop;
|
||||
StorageDead(_1);
|
||||
StorageLive(_2);
|
||||
- _2 = assert_zero_valid::<&u8>() -> [return: bb2, unwind unreachable];
|
||||
+ _2 = assert_zero_valid::<&u8>() -> unwind unreachable;
|
||||
}
|
||||
|
||||
bb2: {
|
||||
nop;
|
||||
nop;
|
||||
StorageDead(_2);
|
||||
StorageLive(_3);
|
||||
- _3 = assert_mem_uninitialized_valid::<&u8>() -> [return: bb3, unwind unreachable];
|
||||
+ _3 = assert_mem_uninitialized_valid::<&u8>() -> unwind unreachable;
|
||||
}
|
||||
|
||||
bb3: {
|
||||
nop;
|
||||
nop;
|
||||
StorageDead(_3);
|
||||
_0 = const ();
|
||||
return;
|
||||
}
|
||||
}
|
@ -8,28 +8,28 @@
|
||||
let _3: ();
|
||||
|
||||
bb0: {
|
||||
nop;
|
||||
StorageLive(_1);
|
||||
- _1 = assert_inhabited::<()>() -> [return: bb1, unwind unreachable];
|
||||
+ goto -> bb1;
|
||||
}
|
||||
|
||||
bb1: {
|
||||
nop;
|
||||
nop;
|
||||
StorageDead(_1);
|
||||
StorageLive(_2);
|
||||
- _2 = assert_zero_valid::<u8>() -> [return: bb2, unwind unreachable];
|
||||
+ goto -> bb2;
|
||||
}
|
||||
|
||||
bb2: {
|
||||
nop;
|
||||
nop;
|
||||
StorageDead(_2);
|
||||
StorageLive(_3);
|
||||
- _3 = assert_mem_uninitialized_valid::<u8>() -> [return: bb3, unwind unreachable];
|
||||
+ goto -> bb3;
|
||||
}
|
||||
|
||||
bb3: {
|
||||
nop;
|
||||
nop;
|
||||
StorageDead(_3);
|
||||
_0 = const ();
|
||||
return;
|
||||
}
|
||||
}
|
@ -1,10 +1,15 @@
|
||||
// skip-filecheck
|
||||
// unit-test: InstSimplify
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#![feature(core_intrinsics)]
|
||||
|
||||
// All these assertions pass, so all the intrinsic calls should be deleted.
|
||||
// EMIT_MIR intrinsic_asserts.removable.InstSimplify.diff
|
||||
pub fn removable() {
|
||||
// CHECK-LABEL: fn removable(
|
||||
// CHECK-NOT: assert_inhabited
|
||||
// CHECK-NOT: assert_zero_valid
|
||||
// CHECK-NOT: assert_mem_uninitialized_valid
|
||||
core::intrinsics::assert_inhabited::<()>();
|
||||
core::intrinsics::assert_zero_valid::<u8>();
|
||||
core::intrinsics::assert_mem_uninitialized_valid::<u8>();
|
||||
@ -15,6 +20,10 @@ enum Never {}
|
||||
// These assertions all diverge, so their target blocks should become None.
|
||||
// EMIT_MIR intrinsic_asserts.panics.InstSimplify.diff
|
||||
pub fn panics() {
|
||||
// CHECK-LABEL: fn panics(
|
||||
// CHECK: assert_inhabited::<Never>() -> unwind
|
||||
// CHECK: assert_zero_valid::<&u8>() -> unwind
|
||||
// CHECK: assert_mem_uninitialized_valid::<&u8>() -> unwind
|
||||
core::intrinsics::assert_inhabited::<Never>();
|
||||
core::intrinsics::assert_zero_valid::<&u8>();
|
||||
core::intrinsics::assert_mem_uninitialized_valid::<&u8>();
|
||||
@ -23,7 +32,19 @@ pub fn panics() {
|
||||
// Whether or not these asserts pass isn't known, so they shouldn't be modified.
|
||||
// EMIT_MIR intrinsic_asserts.generic.InstSimplify.diff
|
||||
pub fn generic<T>() {
|
||||
// CHECK-LABEL: fn generic(
|
||||
// CHECK: assert_inhabited::<T>() -> [return:
|
||||
// CHECK: assert_zero_valid::<T>() -> [return:
|
||||
// CHECK: assert_mem_uninitialized_valid::<T>() -> [return:
|
||||
core::intrinsics::assert_inhabited::<T>();
|
||||
core::intrinsics::assert_zero_valid::<T>();
|
||||
core::intrinsics::assert_mem_uninitialized_valid::<T>();
|
||||
}
|
||||
|
||||
// Whether or not these asserts pass isn't known, so they shouldn't be modified.
|
||||
// EMIT_MIR intrinsic_asserts.generic_ref.InstSimplify.diff
|
||||
pub fn generic_ref<T>() {
|
||||
// CHECK-LABEL: fn generic_ref(
|
||||
// CHECK: assert_mem_uninitialized_valid::<&T>() -> [return:
|
||||
core::intrinsics::assert_mem_uninitialized_valid::<&T>();
|
||||
}
|
Loading…
Reference in New Issue
Block a user