summary refs log tree commit diff
path: root/tests/codegen-llvm/unwind-landingpad-cold.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/codegen-llvm/unwind-landingpad-cold.rs')
-rw-r--r--tests/codegen-llvm/unwind-landingpad-cold.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/codegen-llvm/unwind-landingpad-cold.rs b/tests/codegen-llvm/unwind-landingpad-cold.rs
new file mode 100644
index 00000000000..fb095e04650
--- /dev/null
+++ b/tests/codegen-llvm/unwind-landingpad-cold.rs
@@ -0,0 +1,15 @@
+//@ compile-flags: -Cno-prepopulate-passes
+//@ needs-unwind
+#![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();
+}