From 043d29b58ae4eee0681b1724ed0c20d9ee3ed9e7 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sat, 2 Dec 2023 20:21:53 +0000 Subject: [PATCH] FileCheck and rename const_prop_fails_gracefully. --- .../const_prop/const_prop_fails_gracefully.rs | 12 ------------ ...se_address.main.ConstProp.panic-abort.diff} | 0 ...e_address.main.ConstProp.panic-unwind.diff} | 0 .../const_prop/pointer_expose_address.rs | 18 ++++++++++++++++++ 4 files changed, 18 insertions(+), 12 deletions(-) delete mode 100644 tests/mir-opt/const_prop/const_prop_fails_gracefully.rs rename tests/mir-opt/const_prop/{const_prop_fails_gracefully.main.ConstProp.panic-abort.diff => pointer_expose_address.main.ConstProp.panic-abort.diff} (100%) rename tests/mir-opt/const_prop/{const_prop_fails_gracefully.main.ConstProp.panic-unwind.diff => pointer_expose_address.main.ConstProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/pointer_expose_address.rs diff --git a/tests/mir-opt/const_prop/const_prop_fails_gracefully.rs b/tests/mir-opt/const_prop/const_prop_fails_gracefully.rs deleted file mode 100644 index 5bd4731bf08d4..0000000000000 --- a/tests/mir-opt/const_prop/const_prop_fails_gracefully.rs +++ /dev/null @@ -1,12 +0,0 @@ -// skip-filecheck -// EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: ConstProp -#[inline(never)] -fn read(_: usize) { } - -// EMIT_MIR const_prop_fails_gracefully.main.ConstProp.diff -fn main() { - const FOO: &i32 = &1; - let x = FOO as *const i32 as usize; - read(x); -} diff --git a/tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/pointer_expose_address.main.ConstProp.panic-abort.diff similarity index 100% rename from tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.panic-abort.diff rename to tests/mir-opt/const_prop/pointer_expose_address.main.ConstProp.panic-abort.diff diff --git a/tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/pointer_expose_address.main.ConstProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.panic-unwind.diff rename to tests/mir-opt/const_prop/pointer_expose_address.main.ConstProp.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/pointer_expose_address.rs b/tests/mir-opt/const_prop/pointer_expose_address.rs new file mode 100644 index 0000000000000..631aac901b964 --- /dev/null +++ b/tests/mir-opt/const_prop/pointer_expose_address.rs @@ -0,0 +1,18 @@ +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY +// unit-test: ConstProp + +#[inline(never)] +fn read(_: usize) { } + +// EMIT_MIR pointer_expose_address.main.ConstProp.diff +fn main() { + // CHECK-LABEL: fn main( + // CHECK: [[ptr:_.*]] = const _; + // CHECK: [[ref:_.*]] = &raw const (*[[ptr]]); + // CHECK: [[x:_.*]] = move [[ref]] as usize (PointerExposeAddress); + // CHECK: [[arg:_.*]] = [[x]]; + // CHECK: = read(move [[arg]]) + const FOO: &i32 = &1; + let x = FOO as *const i32 as usize; + read(x); +}