diff options
Diffstat (limited to 'tests/codegen/unwind-landingpad-cold.rs')
-rw-r--r-- | tests/codegen/unwind-landingpad-cold.rs | 16 |
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(); +} |