about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-03-01 08:57:46 +0000
committerbors <bors@rust-lang.org>2022-03-01 08:57:46 +0000
commit4a56cbec59903a830a5fc06c5c81956de4199584 (patch)
tree6365b76a9af58b44aa39e77a49184c946578e4eb /src/test/codegen
parent6e5a6ffb14fc47051b0a23410c681ad6e4af045f (diff)
parent0c784337494223441d53129688bd777ae8df7992 (diff)
downloadrust-4a56cbec59903a830a5fc06c5c81956de4199584.tar.gz
rust-4a56cbec59903a830a5fc06c5c81956de4199584.zip
Auto merge of #94402 - erikdesjardins:revert-coldland, r=nagisa
Revert "Auto merge of #92419 - erikdesjardins:coldland, r=nagisa"

Should fix (untested) #94390

Reopens #46515, #87055

r? `@ehuss`
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/unwind-landingpad-cold.rs15
-rw-r--r--src/test/codegen/unwind-landingpad-inline.rs37
-rw-r--r--src/test/codegen/vec-shrink-panik.rs19
3 files changed, 19 insertions, 52 deletions
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<u32>) {
-    // 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();
-}
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
@@ -17,6 +17,14 @@ pub fn shrink_to_fit(vec: &mut Vec<u32>) {
 #[no_mangle]
 pub fn issue71861(vec: Vec<u32>) -> 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()
 }
 
@@ -24,5 +32,16 @@ pub fn issue71861(vec: Vec<u32>) -> Box<[u32]> {
 #[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