about summary refs log tree commit diff
path: root/tests/codegen
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2025-02-02 12:31:57 +0100
committerGitHub <noreply@github.com>2025-02-02 12:31:57 +0100
commitce5db2f9f18161fa0cb78b78ccd110a6652fdedb (patch)
tree01ad7b9715918d8aa7401464ef4db5443adffef2 /tests/codegen
parent39efaa09d6a284fd932e1b447befc28997438734 (diff)
parent2c35bd0499130af395bdbb49a49d5a019599d22e (diff)
downloadrust-ce5db2f9f18161fa0cb78b78ccd110a6652fdedb.tar.gz
rust-ce5db2f9f18161fa0cb78b78ccd110a6652fdedb.zip
Rollup merge of #136358 - clubby789:opt-none-noinline, r=saethlin
`#[optimize(none)]` implies `#[inline(never)]`

Fixes #136329
Diffstat (limited to 'tests/codegen')
-rw-r--r--tests/codegen/issues/issue-136329-optnone-noinline.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/codegen/issues/issue-136329-optnone-noinline.rs b/tests/codegen/issues/issue-136329-optnone-noinline.rs
new file mode 100644
index 00000000000..57c9e47a499
--- /dev/null
+++ b/tests/codegen/issues/issue-136329-optnone-noinline.rs
@@ -0,0 +1,21 @@
+//! Ensure that `#[optimize(none)]` functions are never inlined
+
+//@ compile-flags: -Copt-level=3
+
+#![feature(optimize_attribute)]
+
+#[optimize(none)]
+pub fn foo() {
+    let _x = 123;
+}
+
+// CHECK-LABEL: define{{.*}}void @bar
+// CHECK: start:
+// CHECK: {{.*}}call {{.*}}void
+// CHECK: ret void
+#[no_mangle]
+pub fn bar() {
+    foo();
+}
+
+fn main() {}