about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-06-07 08:12:45 +0000
committerbors <bors@rust-lang.org>2022-06-07 08:12:45 +0000
commit91cacb3faf987805675e39aca41859ec1fcabef3 (patch)
tree8abbf8d38127f75c7a19f5564b0a6db0b65e29a1 /src/test/codegen
parentbb55bd449e65e611da928560d948982d73e50027 (diff)
parentbe4e0898ccf4f6514a94c3b89ab48bd3a8268ce3 (diff)
downloadrust-91cacb3faf987805675e39aca41859ec1fcabef3.tar.gz
rust-91cacb3faf987805675e39aca41859ec1fcabef3.zip
Auto merge of #97512 - scottmcm:add-coldcc, r=nagisa,lcnr
Add support for emitting functions with `coldcc` to LLVM

The eventual goal is to try using this for things like the internal panicking stuff, to see whether it helps.
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/cold-call-declare-and-call.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/codegen/cold-call-declare-and-call.rs b/src/test/codegen/cold-call-declare-and-call.rs
new file mode 100644
index 00000000000..71d49478bfc
--- /dev/null
+++ b/src/test/codegen/cold-call-declare-and-call.rs
@@ -0,0 +1,18 @@
+// compile-flags: -C no-prepopulate-passes
+
+#![crate_type = "lib"]
+#![feature(rust_cold_cc)]
+
+// wasm marks the definition as `dso_local`, so allow that as optional.
+
+// CHECK: define{{( dso_local)?}} coldcc void @this_should_never_happen(i16
+// CHECK: call coldcc void @this_should_never_happen(i16
+
+#[no_mangle]
+pub extern "rust-cold" fn this_should_never_happen(x: u16) {}
+
+pub fn do_things(x: u16) {
+    if x == 12345 {
+        this_should_never_happen(54321);
+    }
+}