about summary refs log tree commit diff
path: root/tests/codegen
diff options
context:
space:
mode:
Diffstat (limited to 'tests/codegen')
-rw-r--r--tests/codegen/issues/issue-111603.rs12
-rw-r--r--tests/codegen/naked-nocoverage.rs2
-rw-r--r--tests/codegen/sanitizer-cfi-emit-type-metadata-id-itanium-cxx-abi.rs14
-rw-r--r--tests/codegen/stack-protector.rs36
4 files changed, 44 insertions, 20 deletions
diff --git a/tests/codegen/issues/issue-111603.rs b/tests/codegen/issues/issue-111603.rs
index 90b3c314d2f..06429ed3fa9 100644
--- a/tests/codegen/issues/issue-111603.rs
+++ b/tests/codegen/issues/issue-111603.rs
@@ -5,6 +5,18 @@
 
 use std::sync::Arc;
 
+// CHECK-LABEL: @new_from_array
+#[no_mangle]
+pub fn new_from_array(x: u64) -> Arc<[u64]> {
+    // Ensure that we only generate one alloca for the array.
+
+    // CHECK: alloca
+    // CHECK-SAME: [1000 x i64]
+    // CHECK-NOT: alloca
+    let array = [x; 1000];
+    Arc::new(array)
+}
+
 // CHECK-LABEL: @new_uninit
 #[no_mangle]
 pub fn new_uninit(x: u64) -> Arc<[u64; 1000]> {
diff --git a/tests/codegen/naked-nocoverage.rs b/tests/codegen/naked-nocoverage.rs
index 91a6260bf2a..3c755e49c6d 100644
--- a/tests/codegen/naked-nocoverage.rs
+++ b/tests/codegen/naked-nocoverage.rs
@@ -11,7 +11,7 @@ use std::arch::asm;
 #[naked]
 #[no_mangle]
 pub unsafe extern "C" fn f() {
-    // CHECK:       define void @f()
+    // CHECK:       define {{(dso_local )?}}void @f()
     // CHECK-NEXT:  start:
     // CHECK-NEXT:    call void asm
     // CHECK-NEXT:    unreachable
diff --git a/tests/codegen/sanitizer-cfi-emit-type-metadata-id-itanium-cxx-abi.rs b/tests/codegen/sanitizer-cfi-emit-type-metadata-id-itanium-cxx-abi.rs
index 472d921ace0..63e63c5d4aa 100644
--- a/tests/codegen/sanitizer-cfi-emit-type-metadata-id-itanium-cxx-abi.rs
+++ b/tests/codegen/sanitizer-cfi-emit-type-metadata-id-itanium-cxx-abi.rs
@@ -61,7 +61,19 @@ pub type Type9 = impl Send;
 pub type Type10 = impl Send;
 pub type Type11 = impl Send;
 
-pub fn fn1<'a>() {
+pub fn fn1<'a>() where
+    Type1: 'static,
+    Type2: 'static,
+    Type3: 'static,
+    Type4: 'static,
+    Type5: 'static,
+    Type6: 'static,
+    Type7: 'static,
+    Type8: 'static,
+    Type9: 'static,
+    Type10: 'static,
+    Type11: 'static,
+{
     // Closure
     let closure1 = || { };
     let _: Type1 = closure1;
diff --git a/tests/codegen/stack-protector.rs b/tests/codegen/stack-protector.rs
index a24e6f1e4f1..a680789af15 100644
--- a/tests/codegen/stack-protector.rs
+++ b/tests/codegen/stack-protector.rs
@@ -10,25 +10,25 @@
 pub fn foo() {
     // CHECK: @foo() unnamed_addr #0
 
-    // all-NOT: attributes #0 = { {{.*}} sspstrong {{.*}} }
-    // all-NOT: attributes #0 = { {{.*}} ssp {{.*}} }
-    // all: attributes #0 = { {{.*}} sspreq {{.*}} }
-    // all-NOT: attributes #0 = { {{.*}} sspstrong {{.*}} }
-    // all-NOT: attributes #0 = { {{.*}} ssp {{.*}} }
+    // all-NOT: attributes #0 = { {{.*}}sspstrong {{.*}} }
+    // all-NOT: attributes #0 = { {{.*}}ssp {{.*}} }
+    // all: attributes #0 = { {{.*}}sspreq {{.*}} }
+    // all-NOT: attributes #0 = { {{.*}}sspstrong {{.*}} }
+    // all-NOT: attributes #0 = { {{.*}}ssp {{.*}} }
 
-    // strong-NOT: attributes #0 = { {{.*}} sspreq {{.*}} }
-    // strong-NOT: attributes #0 = { {{.*}} ssp {{.*}} }
-    // strong: attributes #0 = { {{.*}} sspstrong {{.*}} }
-    // strong-NOT: attributes #0 = { {{.*}} sspreq {{.*}} }
-    // strong-NOT: attributes #0 = { {{.*}} ssp {{.*}} }
+    // strong-NOT: attributes #0 = { {{.*}}sspreq {{.*}} }
+    // strong-NOT: attributes #0 = { {{.*}}ssp {{.*}} }
+    // strong: attributes #0 = { {{.*}}sspstrong {{.*}} }
+    // strong-NOT: attributes #0 = { {{.*}}sspreq {{.*}} }
+    // strong-NOT: attributes #0 = { {{.*}}ssp {{.*}} }
 
-    // basic-NOT: attributes #0 = { {{.*}} sspreq {{.*}} }
-    // basic-NOT: attributes #0 = { {{.*}} sspstrong {{.*}} }
-    // basic: attributes #0 = { {{.*}} ssp {{.*}} }
-    // basic-NOT: attributes #0 = { {{.*}} sspreq {{.*}} }
-    // basic-NOT: attributes #0 = { {{.*}} sspstrong {{.*}} }
+    // basic-NOT: attributes #0 = { {{.*}}sspreq {{.*}} }
+    // basic-NOT: attributes #0 = { {{.*}}sspstrong {{.*}} }
+    // basic: attributes #0 = { {{.*}}ssp {{.*}} }
+    // basic-NOT: attributes #0 = { {{.*}}sspreq {{.*}} }
+    // basic-NOT: attributes #0 = { {{.*}}sspstrong {{.*}} }
 
-    // none-NOT: attributes #0 = { {{.*}} sspreq {{.*}} }
-    // none-NOT: attributes #0 = { {{.*}} sspstrong {{.*}} }
-    // none-NOT: attributes #0 = { {{.*}} ssp {{.*}} }
+    // none-NOT: attributes #0 = { {{.*}}sspreq {{.*}} }
+    // none-NOT: attributes #0 = { {{.*}}sspstrong {{.*}} }
+    // none-NOT: attributes #0 = { {{.*}}ssp {{.*}} }
 }