summary refs log tree commit diff
path: root/tests/codegen/issues
diff options
context:
space:
mode:
authorclubby789 <jamie@hill-daniel.co.uk>2025-01-31 16:10:21 +0000
committerclubby789 <jamie@hill-daniel.co.uk>2025-01-31 17:51:49 +0000
commit2c35bd0499130af395bdbb49a49d5a019599d22e (patch)
treee4acf9814fda7d398578482e95868391e7395a8e /tests/codegen/issues
parent7f36543a48e52912ac6664a70c0a5b9d86509eaf (diff)
downloadrust-2c35bd0499130af395bdbb49a49d5a019599d22e.tar.gz
rust-2c35bd0499130af395bdbb49a49d5a019599d22e.zip
`#[optimize(none)]` implies `#[inline(never)]`
Diffstat (limited to 'tests/codegen/issues')
-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() {}