about summary refs log tree commit diff
path: root/tests/codegen
diff options
context:
space:
mode:
authorclubby789 <jamie@hill-daniel.co.uk>2024-12-09 19:00:43 +0000
committerclubby789 <jamie@hill-daniel.co.uk>2025-01-23 17:19:53 +0000
commitcd848c9f3eebcb4a0940e1370d3e6ba9b0fe4bca (patch)
tree624c404e33ed83c8d84234c7c5337a8f6ffa68d3 /tests/codegen
parentdee7d0e730a3a3ed98c89dd33c4ac16edc82de8a (diff)
downloadrust-cd848c9f3eebcb4a0940e1370d3e6ba9b0fe4bca.tar.gz
rust-cd848c9f3eebcb4a0940e1370d3e6ba9b0fe4bca.zip
Implement `optimize(none)` attribute
Diffstat (limited to 'tests/codegen')
-rw-r--r--tests/codegen/optimize-attr-1.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/codegen/optimize-attr-1.rs b/tests/codegen/optimize-attr-1.rs
index 3aee44791e0..db6bdcf9a8b 100644
--- a/tests/codegen/optimize-attr-1.rs
+++ b/tests/codegen/optimize-attr-1.rs
@@ -37,11 +37,23 @@ pub fn speed() -> i32 {
     4 + 4
 }
 
+// CHECK-LABEL: define{{.*}}i32 @none
+// CHECK-SAME: [[NONE_ATTRS:#[0-9]+]]
+// SIZE-OPT: alloca
+// SPEED-OPT: alloca
+#[no_mangle]
+#[optimize(none)]
+pub fn none() -> i32 {
+    let arr = [0, 1, 2, 3, 4];
+    arr[4]
+}
+
 // NO-OPT-DAG: attributes [[SIZE_ATTRS]] = {{.*}}minsize{{.*}}optsize{{.*}}
 // SPEED-OPT-DAG: attributes [[SIZE_ATTRS]] = {{.*}}minsize{{.*}}optsize{{.*}}
 // SIZE-OPT-DAG: attributes [[NOTHING_ATTRS]] = {{.*}}optsize{{.*}}
 // SIZE-OPT-DAG: attributes [[SIZE_ATTRS]] = {{.*}}minsize{{.*}}optsize{{.*}}
+// CHECK-DAG: attributes [[NONE_ATTRS]] = {{.*}}noinline{{.*}}optnone{{.*}}
 
-// SIZE-OPT: attributes [[SPEED_ATTRS]]
+// SIZE-OPT-DAG: attributes [[SPEED_ATTRS]]
 // SIZE-OPT-NOT: minsize
 // SIZE-OPT-NOT: optsize