From 851fcc7a54262748b1aa9e16de91453998d896f3 Mon Sep 17 00:00:00 2001 From: Erik Desjardins Date: Sat, 26 Feb 2022 12:52:07 -0500 Subject: Revert "Auto merge of #92419 - erikdesjardins:coldland, r=nagisa" This reverts commit 4f49627c6fe2a32d1fed6310466bb0e1c535c0c0, reversing changes made to 028c6f1454787c068ff5117e9000a1de4fd98374. --- src/test/codegen/unwind-landingpad-cold.rs | 15 ----------- src/test/codegen/unwind-landingpad-inline.rs | 37 ---------------------------- 2 files changed, 52 deletions(-) delete mode 100644 src/test/codegen/unwind-landingpad-cold.rs delete mode 100644 src/test/codegen/unwind-landingpad-inline.rs (limited to 'src/test/codegen') diff --git a/src/test/codegen/unwind-landingpad-cold.rs b/src/test/codegen/unwind-landingpad-cold.rs deleted file mode 100644 index aa00b793654..00000000000 --- a/src/test/codegen/unwind-landingpad-cold.rs +++ /dev/null @@ -1,15 +0,0 @@ -// no-system-llvm: needs #92110 -// compile-flags: -Cno-prepopulate-passes -#![crate_type = "lib"] - -// This test checks that drop calls in unwind landing pads -// get the `cold` attribute. - -// CHECK-LABEL: @check_cold -// CHECK: {{(call|invoke) void .+}}drop_in_place{{.+}} [[ATTRIBUTES:#[0-9]+]] -// CHECK: attributes [[ATTRIBUTES]] = { cold } -#[no_mangle] -pub fn check_cold(f: fn(), x: Box) { - // this may unwind - f(); -} diff --git a/src/test/codegen/unwind-landingpad-inline.rs b/src/test/codegen/unwind-landingpad-inline.rs deleted file mode 100644 index ce78d075dd0..00000000000 --- a/src/test/codegen/unwind-landingpad-inline.rs +++ /dev/null @@ -1,37 +0,0 @@ -// no-system-llvm: needs #92110 + patch for Rust alloc/dealloc functions -// compile-flags: -Copt-level=3 -#![crate_type = "lib"] - -// This test checks that we can inline drop_in_place in -// unwind landing pads. - -// Without inlining, the box pointers escape via the call to drop_in_place, -// and LLVM will not optimize out the pointer comparison. -// With inlining, everything should be optimized out. -// See https://github.com/rust-lang/rust/issues/46515 -// CHECK-LABEL: @check_no_escape_in_landingpad -// CHECK: start: -// CHECK-NEXT: ret void -#[no_mangle] -pub fn check_no_escape_in_landingpad(f: fn()) { - let x = &*Box::new(0); - let y = &*Box::new(0); - - if x as *const _ == y as *const _ { - f(); - } -} - -// Without inlining, the compiler can't tell that -// dropping an empty string (in a landing pad) does nothing. -// With inlining, the landing pad should be optimized out. -// See https://github.com/rust-lang/rust/issues/87055 -// CHECK-LABEL: @check_eliminate_noop_drop -// CHECK: start: -// CHECK-NEXT: call void %g() -// CHECK-NEXT: ret void -#[no_mangle] -pub fn check_eliminate_noop_drop(g: fn()) { - let _var = String::new(); - g(); -} -- cgit 1.4.1-3-g733a5 From 0c784337494223441d53129688bd777ae8df7992 Mon Sep 17 00:00:00 2001 From: Erik Desjardins Date: Sun, 27 Feb 2022 23:15:49 -0500 Subject: update vec-shrink-panik test to allow panic_no_unwind in landingpads --- src/test/codegen/vec-shrink-panik.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/test/codegen') diff --git a/src/test/codegen/vec-shrink-panik.rs b/src/test/codegen/vec-shrink-panik.rs index 6b0ac78857a..18409014bde 100644 --- a/src/test/codegen/vec-shrink-panik.rs +++ b/src/test/codegen/vec-shrink-panik.rs @@ -16,6 +16,14 @@ pub fn shrink_to_fit(vec: &mut Vec) { // CHECK-LABEL: @issue71861 #[no_mangle] pub fn issue71861(vec: Vec) -> Box<[u32]> { + // CHECK-NOT: panic + + // Call to panic_no_unwind in case of double-panic is expected, + // but other panics are not. + // CHECK: cleanup + // CHECK-NEXT: ; call core::panicking::panic_no_unwind + // CHECK-NEXT: panic_no_unwind + // CHECK-NOT: panic vec.into_boxed_slice() } @@ -23,6 +31,17 @@ pub fn issue71861(vec: Vec) -> Box<[u32]> { // CHECK-LABEL: @issue75636 #[no_mangle] pub fn issue75636<'a>(iter: &[&'a str]) -> Box<[&'a str]> { + // CHECK-NOT: panic + + // Call to panic_no_unwind in case of double-panic is expected, + // but other panics are not. + // CHECK: cleanup + // CHECK-NEXT: ; call core::panicking::panic_no_unwind + // CHECK-NEXT: panic_no_unwind + // CHECK-NOT: panic iter.iter().copied().collect() } + +// CHECK: ; core::panicking::panic_no_unwind +// CHECK: declare void @{{.*}}panic_no_unwind -- cgit 1.4.1-3-g733a5