summaryrefslogtreecommitdiffstats
path: root/tests/codegen/unwind-landingpad-cold.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /tests/codegen/unwind-landingpad-cold.rs
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/codegen/unwind-landingpad-cold.rs')
-rw-r--r--tests/codegen/unwind-landingpad-cold.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/codegen/unwind-landingpad-cold.rs b/tests/codegen/unwind-landingpad-cold.rs
new file mode 100644
index 000000000..3a902a7d7
--- /dev/null
+++ b/tests/codegen/unwind-landingpad-cold.rs
@@ -0,0 +1,16 @@
+// compile-flags: -Cno-prepopulate-passes
+// needs-unwind
+// min-llvm-version: 17.0.2
+#![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();
+}