summaryrefslogtreecommitdiffstats
path: root/tests/codegen
diff options
context:
space:
mode:
Diffstat (limited to 'tests/codegen')
-rw-r--r--tests/codegen/asm-maybe-uninit.rs27
-rw-r--r--tests/codegen/async-fn-debug-awaitee-field.rs10
-rw-r--r--tests/codegen/box-uninit-bytes.rs (renamed from tests/codegen/box-maybe-uninit.rs)14
-rw-r--r--tests/codegen/cold-call-declare-and-call.rs13
-rw-r--r--tests/codegen/debuginfo-inline-callsite-location.rs28
-rw-r--r--tests/codegen/issues/issue-105386-ub-in-debuginfo.rs4
-rw-r--r--tests/codegen/issues/issue-115385-llvm-jump-threading.rs46
-rw-r--r--tests/codegen/lib-optimizations/iter-sum.rs15
-rw-r--r--tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs4
-rw-r--r--tests/codegen/macos/i686-macosx-deployment-target.rs4
-rw-r--r--tests/codegen/macos/i686-no-macosx-deployment-target.rs2
-rw-r--r--tests/codegen/macos/x86_64-macosx-deployment-target.rs4
-rw-r--r--tests/codegen/macos/x86_64-no-macosx-deployment-target.rs2
-rw-r--r--tests/codegen/move-before-nocapture-ref-arg.rs22
-rw-r--r--tests/codegen/repr/transparent.rs1
-rw-r--r--tests/codegen/sanitizer/address-sanitizer-globals-tracking.rs44
-rw-r--r--tests/codegen/sanitizer/cfi-emit-type-metadata-id-itanium-cxx-abi.rs12
-rw-r--r--tests/codegen/sanitizer/kcfi-add-kcfi-flag.rs13
-rw-r--r--tests/codegen/sanitizer/memory-track-origins.rs11
-rw-r--r--tests/codegen/sanitizer/no-sanitize-inlining.rs5
-rw-r--r--tests/codegen/sanitizer/no-sanitize.rs2
-rw-r--r--tests/codegen/sanitizer/sanitizer-recover.rs1
-rw-r--r--tests/codegen/slice-as_chunks.rs6
-rw-r--r--tests/codegen/slice-iter-nonnull.rs6
-rw-r--r--tests/codegen/tuple-layout-opt.rs1
-rw-r--r--tests/codegen/vecdeque-nonempty-get-no-panic.rs17
26 files changed, 273 insertions, 41 deletions
diff --git a/tests/codegen/asm-maybe-uninit.rs b/tests/codegen/asm-maybe-uninit.rs
new file mode 100644
index 000000000..d7e4a9489
--- /dev/null
+++ b/tests/codegen/asm-maybe-uninit.rs
@@ -0,0 +1,27 @@
+// compile-flags: -O
+// only-x86_64
+
+#![crate_type = "rlib"]
+#![allow(asm_sub_register)]
+
+use std::mem::MaybeUninit;
+use std::arch::asm;
+
+// CHECK-LABEL: @int
+#[no_mangle]
+pub unsafe fn int(x: MaybeUninit<i32>) -> MaybeUninit<i32> {
+ let y: MaybeUninit<i32>;
+ asm!("/*{}{}*/", in(reg) x, out(reg) y);
+ y
+}
+
+// CHECK-LABEL: @inout
+#[no_mangle]
+pub unsafe fn inout(mut x: i32) -> MaybeUninit<u32> {
+ let mut y: MaybeUninit<u32>;
+ asm!("/*{}*/", inout(reg) x => y);
+ asm!("/*{}*/", inout(reg) y => x);
+ asm!("/*{}*/", inlateout(reg) x => y);
+ asm!("/*{}*/", inlateout(reg) y => x);
+ y
+}
diff --git a/tests/codegen/async-fn-debug-awaitee-field.rs b/tests/codegen/async-fn-debug-awaitee-field.rs
index bc2686158..690505fd7 100644
--- a/tests/codegen/async-fn-debug-awaitee-field.rs
+++ b/tests/codegen/async-fn-debug-awaitee-field.rs
@@ -5,12 +5,14 @@
// ignore-tidy-linelength
// compile-flags: -C debuginfo=2 --edition=2018
-async fn foo() {}
+#![crate_type = "lib"]
-async fn async_fn_test() {
+pub async fn async_fn_test() {
foo().await;
}
+pub async fn foo() {}
+
// NONMSVC: [[GEN:!.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "{async_fn_env#0}", scope: [[GEN_SCOPE:![0-9]*]],
// MSVC: [[GEN:!.*]] = !DICompositeType(tag: DW_TAG_union_type, name: "enum2$<async_fn_debug_awaitee_field::async_fn_test::async_fn_env$0>",
// NONMSVC: [[GEN_SCOPE:!.*]] = !DINamespace(name: "async_fn_test",
@@ -19,7 +21,3 @@ async fn async_fn_test() {
// NONMSVC: [[AWAITEE_TYPE]] = !DICompositeType(tag: DW_TAG_structure_type, name: "{async_fn_env#0}", scope: [[AWAITEE_SCOPE:![0-9]*]],
// MSVC: [[AWAITEE_TYPE]] = !DICompositeType(tag: DW_TAG_union_type, name: "enum2$<async_fn_debug_awaitee_field::foo::async_fn_env$0>",
// NONMSVC: [[AWAITEE_SCOPE]] = !DINamespace(name: "foo",
-
-fn main() {
- let _fn = async_fn_test();
-}
diff --git a/tests/codegen/box-maybe-uninit.rs b/tests/codegen/box-uninit-bytes.rs
index 282af99b0..732da0a17 100644
--- a/tests/codegen/box-maybe-uninit.rs
+++ b/tests/codegen/box-uninit-bytes.rs
@@ -25,6 +25,20 @@ pub fn box_uninitialized2() -> Box<MaybeUninit<[usize; 1024 * 1024]>> {
Box::new(MaybeUninit::uninit())
}
+#[repr(align(1024))]
+pub struct LotsaPadding(usize);
+
+// Boxing a value with padding should not copy junk from the stack
+#[no_mangle]
+pub fn box_lotsa_padding() -> Box<LotsaPadding> {
+ // CHECK-LABEL: @box_lotsa_padding
+ // CHECK-NOT: alloca
+ // CHECK-NOT: getelementptr
+ // CHECK-NOT: memcpy
+ // CHECK-NOT: memset
+ Box::new(LotsaPadding(42))
+}
+
// Hide the `allocalign` attribute in the declaration of __rust_alloc
// from the CHECK-NOT above, and also verify the attributes got set reasonably.
// CHECK: declare {{(dso_local )?}}noalias noundef ptr @__rust_alloc(i{{[0-9]+}} noundef, i{{[0-9]+}} allocalign noundef) unnamed_addr [[RUST_ALLOC_ATTRS:#[0-9]+]]
diff --git a/tests/codegen/cold-call-declare-and-call.rs b/tests/codegen/cold-call-declare-and-call.rs
index 71d49478b..572dc407f 100644
--- a/tests/codegen/cold-call-declare-and-call.rs
+++ b/tests/codegen/cold-call-declare-and-call.rs
@@ -1,12 +1,21 @@
+// revisions: NORMAL WINDOWS
// compile-flags: -C no-prepopulate-passes
+//[NORMAL] ignore-windows
+//[WINDOWS] only-windows
+//[WINDOWS] only-x86_64
#![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
+// NORMAL: define{{( dso_local)?}} preserve_mostcc void @this_should_never_happen(i16
+// NORMAL: call preserve_mostcc void @this_should_never_happen(i16
+
+// See the comment in `Target::adjust_abi` for why this differs
+
+// WINDOWS: define void @this_should_never_happen(i16
+// WINDOWS: call void @this_should_never_happen(i16
#[no_mangle]
pub extern "rust-cold" fn this_should_never_happen(x: u16) {}
diff --git a/tests/codegen/debuginfo-inline-callsite-location.rs b/tests/codegen/debuginfo-inline-callsite-location.rs
new file mode 100644
index 000000000..b1475ee79
--- /dev/null
+++ b/tests/codegen/debuginfo-inline-callsite-location.rs
@@ -0,0 +1,28 @@
+// compile-flags: -g -O
+
+// Check that each inline call site for the same function uses the same "sub-program" so that LLVM
+// can correctly merge the debug info if it merges the inlined code (e.g., for merging of tail
+// calls to panic.
+
+// CHECK: tail call void @_ZN4core9panicking5panic17h{{([0-9a-z]{16})}}E
+// CHECK-SAME: !dbg ![[#first_dbg:]]
+// CHECK: tail call void @_ZN4core9panicking5panic17h{{([0-9a-z]{16})}}E
+// CHECK-SAME: !dbg ![[#second_dbg:]]
+
+// CHECK-DAG: ![[#func_dbg:]] = distinct !DISubprogram(name: "unwrap<i32>"
+// CHECK-DAG: ![[#first_scope:]] = distinct !DILexicalBlock(scope: ![[#func_dbg]],
+// CHECK: ![[#second_scope:]] = distinct !DILexicalBlock(scope: ![[#func_dbg]],
+// CHECK: ![[#first_dbg]] = !DILocation(line: [[#]]
+// CHECK-SAME: scope: ![[#first_scope]], inlinedAt: ![[#]])
+// CHECK: ![[#second_dbg]] = !DILocation(line: [[#]]
+// CHECK-SAME: scope: ![[#second_scope]], inlinedAt: ![[#]])
+
+#![crate_type = "lib"]
+
+#[no_mangle]
+extern "C" fn add_numbers(x: &Option<i32>, y: &Option<i32>) -> i32 {
+ let x1 = x.unwrap();
+ let y1 = y.unwrap();
+
+ x1 + y1
+}
diff --git a/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs b/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs
index f345c96e6..54c50f840 100644
--- a/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs
+++ b/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs
@@ -15,8 +15,8 @@ pub fn outer_function(x: S, y: S) -> usize {
// Check that we do not attempt to load from the spilled arg before it is assigned to
// when generating debuginfo.
// CHECK-LABEL: @outer_function
-// CHECK: [[spill:%.*]] = alloca %"[closure@{{.*.rs}}:9:23: 9:25]"
-// CHECK-NOT: [[ptr_tmp:%.*]] = getelementptr inbounds %"[closure@{{.*.rs}}:9:23: 9:25]", ptr [[spill]]
+// CHECK: [[spill:%.*]] = alloca %"{closure@{{.*.rs}}:9:23: 9:25}"
+// CHECK-NOT: [[ptr_tmp:%.*]] = getelementptr inbounds %"{closure@{{.*.rs}}:9:23: 9:25}", ptr [[spill]]
// CHECK-NOT: [[load:%.*]] = load ptr, ptr
// CHECK: call void @llvm.lifetime.start{{.*}}({{.*}}, ptr [[spill]])
// CHECK: [[inner:%.*]] = getelementptr inbounds %"{{.*}}", ptr [[spill]]
diff --git a/tests/codegen/issues/issue-115385-llvm-jump-threading.rs b/tests/codegen/issues/issue-115385-llvm-jump-threading.rs
new file mode 100644
index 000000000..142e3596d
--- /dev/null
+++ b/tests/codegen/issues/issue-115385-llvm-jump-threading.rs
@@ -0,0 +1,46 @@
+// compile-flags: -O -Ccodegen-units=1
+
+#![crate_type = "lib"]
+
+#[repr(i64)]
+pub enum Boolean {
+ False = 0,
+ True = 1,
+}
+
+impl Clone for Boolean {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+
+impl Copy for Boolean {}
+
+extern "C" {
+ fn set_value(foo: *mut i64);
+ fn bar();
+}
+
+pub fn foo(x: bool) {
+ let mut foo = core::mem::MaybeUninit::<i64>::uninit();
+ unsafe {
+ set_value(foo.as_mut_ptr());
+ }
+
+ if x {
+ let l1 = unsafe { *foo.as_mut_ptr().cast::<Boolean>() };
+ if matches!(l1, Boolean::False) {
+ unsafe {
+ *foo.as_mut_ptr() = 0;
+ }
+ }
+ }
+
+ let l2 = unsafe { *foo.as_mut_ptr() };
+ if l2 == 2 {
+ // CHECK: call void @bar
+ unsafe {
+ bar();
+ }
+ }
+}
diff --git a/tests/codegen/lib-optimizations/iter-sum.rs b/tests/codegen/lib-optimizations/iter-sum.rs
new file mode 100644
index 000000000..ff7ca6ef6
--- /dev/null
+++ b/tests/codegen/lib-optimizations/iter-sum.rs
@@ -0,0 +1,15 @@
+// ignore-debug: the debug assertions get in the way
+// compile-flags: -O
+// only-x86_64 (vectorization varies between architectures)
+#![crate_type = "lib"]
+
+
+// Ensure that slice + take + sum gets vectorized.
+// Currently this relies on the slice::Iter::try_fold implementation
+// CHECK-LABEL: @slice_take_sum
+#[no_mangle]
+pub fn slice_take_sum(s: &[u64], l: usize) -> u64 {
+ // CHECK: vector.body:
+ // CHECK: ret
+ s.iter().take(l).sum()
+}
diff --git a/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs b/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs
index 7555553c2..591ccd45a 100644
--- a/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs
+++ b/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs
@@ -250,11 +250,11 @@ pub struct IntDoubleInt {
c: i32,
}
-// CHECK: define void @f_int_double_int_s_arg(ptr noalias nocapture noundef dereferenceable(24) %a)
+// CHECK: define void @f_int_double_int_s_arg(ptr noalias nocapture noundef align 8 dereferenceable(24) %a)
#[no_mangle]
pub extern "C" fn f_int_double_int_s_arg(a: IntDoubleInt) {}
-// CHECK: define void @f_ret_int_double_int_s(ptr noalias nocapture noundef sret(%IntDoubleInt) dereferenceable(24) %0)
+// CHECK: define void @f_ret_int_double_int_s(ptr noalias nocapture noundef sret(%IntDoubleInt) align 8 dereferenceable(24) %_0)
#[no_mangle]
pub extern "C" fn f_ret_int_double_int_s() -> IntDoubleInt {
IntDoubleInt { a: 1, b: 2., c: 3 }
diff --git a/tests/codegen/macos/i686-macosx-deployment-target.rs b/tests/codegen/macos/i686-macosx-deployment-target.rs
index 17258a264..ba49178dc 100644
--- a/tests/codegen/macos/i686-macosx-deployment-target.rs
+++ b/tests/codegen/macos/i686-macosx-deployment-target.rs
@@ -4,7 +4,7 @@
// compile-flags: -O --target=i686-apple-darwin --crate-type=rlib
// needs-llvm-components: x86
-// rustc-env:MACOSX_DEPLOYMENT_TARGET=10.9
+// rustc-env:MACOSX_DEPLOYMENT_TARGET=10.14
#![feature(no_core, lang_items)]
#![no_core]
@@ -20,7 +20,7 @@ pub struct Bool {
b: bool,
}
-// CHECK: target triple = "i686-apple-macosx10.9.0"
+// CHECK: target triple = "i686-apple-macosx10.14.0"
#[no_mangle]
pub extern "C" fn structbool() -> Bool {
Bool { b: true }
diff --git a/tests/codegen/macos/i686-no-macosx-deployment-target.rs b/tests/codegen/macos/i686-no-macosx-deployment-target.rs
index 043040a95..479fe7968 100644
--- a/tests/codegen/macos/i686-no-macosx-deployment-target.rs
+++ b/tests/codegen/macos/i686-no-macosx-deployment-target.rs
@@ -20,7 +20,7 @@ pub struct Bool {
b: bool,
}
-// CHECK: target triple = "i686-apple-macosx10.7.0"
+// CHECK: target triple = "i686-apple-macosx10.12.0"
#[no_mangle]
pub extern "C" fn structbool() -> Bool {
Bool { b: true }
diff --git a/tests/codegen/macos/x86_64-macosx-deployment-target.rs b/tests/codegen/macos/x86_64-macosx-deployment-target.rs
index 8e673d11d..957c727bb 100644
--- a/tests/codegen/macos/x86_64-macosx-deployment-target.rs
+++ b/tests/codegen/macos/x86_64-macosx-deployment-target.rs
@@ -4,7 +4,7 @@
// compile-flags: -O --target=x86_64-apple-darwin --crate-type=rlib
// needs-llvm-components: x86
-// rustc-env:MACOSX_DEPLOYMENT_TARGET=10.9
+// rustc-env:MACOSX_DEPLOYMENT_TARGET=10.14
#![feature(no_core, lang_items)]
#![no_core]
@@ -20,7 +20,7 @@ pub struct Bool {
b: bool,
}
-// CHECK: target triple = "x86_64-apple-macosx10.9.0"
+// CHECK: target triple = "x86_64-apple-macosx10.14.0"
#[no_mangle]
pub extern "C" fn structbool() -> Bool {
Bool { b: true }
diff --git a/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs b/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs
index 25ae6924d..edbc1b66c 100644
--- a/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs
+++ b/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs
@@ -20,7 +20,7 @@ pub struct Bool {
b: bool,
}
-// CHECK: target triple = "x86_64-apple-macosx10.7.0"
+// CHECK: target triple = "x86_64-apple-macosx10.12.0"
#[no_mangle]
pub extern "C" fn structbool() -> Bool {
Bool { b: true }
diff --git a/tests/codegen/move-before-nocapture-ref-arg.rs b/tests/codegen/move-before-nocapture-ref-arg.rs
new file mode 100644
index 000000000..c7b400c8f
--- /dev/null
+++ b/tests/codegen/move-before-nocapture-ref-arg.rs
@@ -0,0 +1,22 @@
+// Verify that move before the call of the function with noalias, nocapture, readonly.
+// #107436
+// compile-flags: -O
+// min-llvm-version: 17
+
+#![crate_type = "lib"]
+
+#[repr(C)]
+pub struct ThreeSlices<'a>(&'a [u32], &'a [u32], &'a [u32]);
+
+#[no_mangle]
+pub fn sum_slices(val: ThreeSlices) -> u32 {
+ // CHECK-NOT: memcpy
+ let val = val;
+ sum(&val)
+}
+
+#[no_mangle]
+#[inline(never)]
+pub fn sum(val: &ThreeSlices) -> u32 {
+ val.0.iter().sum::<u32>() + val.1.iter().sum::<u32>() + val.2.iter().sum::<u32>()
+}
diff --git a/tests/codegen/repr/transparent.rs b/tests/codegen/repr/transparent.rs
index b140fc719..c5974248b 100644
--- a/tests/codegen/repr/transparent.rs
+++ b/tests/codegen/repr/transparent.rs
@@ -43,7 +43,6 @@ pub extern "C" fn test_WithZst(_: WithZst) -> WithZst { loop {} }
#[repr(transparent)]
pub struct WithZeroSizedArray(*const f32, [i8; 0]);
-// Apparently we use i32* when newtype-unwrapping f32 pointers. Whatever.
// CHECK: define{{.*}}ptr @test_WithZeroSizedArray(ptr noundef %_1)
#[no_mangle]
pub extern "C" fn test_WithZeroSizedArray(_: WithZeroSizedArray) -> WithZeroSizedArray { loop {} }
diff --git a/tests/codegen/sanitizer/address-sanitizer-globals-tracking.rs b/tests/codegen/sanitizer/address-sanitizer-globals-tracking.rs
new file mode 100644
index 000000000..e9dd04e19
--- /dev/null
+++ b/tests/codegen/sanitizer/address-sanitizer-globals-tracking.rs
@@ -0,0 +1,44 @@
+// Verifies that AddressSanitizer symbols show up as expected in LLVM IR with `-Zsanitizer`.
+// This is a regression test for https://github.com/rust-lang/rust/issues/113404
+//
+// Notes about the `compile-flags` below:
+//
+// * The original issue only reproed with LTO - this is why this angle has
+// extra test coverage via different `revisions`
+// * To observe the failure/repro at LLVM-IR level we need to use `staticlib`
+// which necessitates `-C prefer-dynamic=false` - without the latter flag,
+// we would have run into "cannot prefer dynamic linking when performing LTO".
+//
+// The test is restricted to `only-linux`, because the sanitizer-related instrumentation is target
+// specific. In particular, `___asan_globals_registered` is only used in the
+// `InstrumentGlobalsELF` and `InstrumentGlobalsMachO` code paths. The `only-linux` filter is
+// narrower than really needed (i.e. narrower than ELF-or-MachO), but this seems ok - having a
+// linux-only regression test should be sufficient here.
+//
+// needs-sanitizer-address
+// only-linux
+//
+// revisions:ASAN ASAN-FAT-LTO
+// compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static
+//[ASAN] compile-flags:
+//[ASAN-FAT-LTO] compile-flags: -Cprefer-dynamic=false -Clto=fat
+
+#![crate_type="staticlib"]
+
+// The test below mimics `CACHED_POW10` from `library/core/src/num/flt2dec/strategy/grisu.rs` which
+// (because of incorrect handling of `___asan_globals_registered` during LTO) was incorrectly
+// reported as an ODR violation in https://crbug.com/1459233#c1. Before this bug was fixed,
+// `___asan_globals_registered` would show up as `internal global i64` rather than `common hidden
+// global i64`. (The test expectations ignore the exact type because on `arm-android` the type
+// is `i32` rather than `i64`.)
+//
+// CHECK: @___asan_globals_registered = common hidden global
+// CHECK: @__start_asan_globals = extern_weak hidden global
+// CHECK: @__stop_asan_globals = extern_weak hidden global
+#[no_mangle]
+pub static CACHED_POW10: [(u64, i16, i16); 4] = [
+ (0xe61acf033d1a45df, -1087, -308),
+ (0xab70fe17c79ac6ca, -1060, -300),
+ (0xff77b1fcbebcdc4f, -1034, -292),
+ (0xbe5691ef416bd60c, -1007, -284),
+];
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 da608e180..2d8b13e20 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
@@ -500,12 +500,12 @@ pub fn foo149(_: Type14<Bar>, _: Type14<Bar>, _: Type14<Bar>) { }
// CHECK: ![[TYPE45]] = !{i64 0, !"_ZTSFvu5usizeE"}
// CHECK: ![[TYPE46]] = !{i64 0, !"_ZTSFvu5usizeS_E"}
// CHECK: ![[TYPE47]] = !{i64 0, !"_ZTSFvu5usizeS_S_E"}
-// CHECK: ![[TYPE48]] = !{i64 0, !"_ZTSFvu3f32E"}
-// CHECK: ![[TYPE49]] = !{i64 0, !"_ZTSFvu3f32S_E"}
-// CHECK: ![[TYPE50]] = !{i64 0, !"_ZTSFvu3f32S_S_E"}
-// CHECK: ![[TYPE51]] = !{i64 0, !"_ZTSFvu3f64E"}
-// CHECK: ![[TYPE52]] = !{i64 0, !"_ZTSFvu3f64S_E"}
-// CHECK: ![[TYPE53]] = !{i64 0, !"_ZTSFvu3f64S_S_E"}
+// CHECK: ![[TYPE48]] = !{i64 0, !"_ZTSFvfE"}
+// CHECK: ![[TYPE49]] = !{i64 0, !"_ZTSFvffE"}
+// CHECK: ![[TYPE50]] = !{i64 0, !"_ZTSFvfffE"}
+// CHECK: ![[TYPE51]] = !{i64 0, !"_ZTSFvdE"}
+// CHECK: ![[TYPE52]] = !{i64 0, !"_ZTSFvddE"}
+// CHECK: ![[TYPE53]] = !{i64 0, !"_ZTSFvdddE"}
// CHECK: ![[TYPE54]] = !{i64 0, !"_ZTSFvu4charE"}
// CHECK: ![[TYPE55]] = !{i64 0, !"_ZTSFvu4charS_E"}
// CHECK: ![[TYPE56]] = !{i64 0, !"_ZTSFvu4charS_S_E"}
diff --git a/tests/codegen/sanitizer/kcfi-add-kcfi-flag.rs b/tests/codegen/sanitizer/kcfi-add-kcfi-flag.rs
index c2eb852ae..6d466b93c 100644
--- a/tests/codegen/sanitizer/kcfi-add-kcfi-flag.rs
+++ b/tests/codegen/sanitizer/kcfi-add-kcfi-flag.rs
@@ -1,9 +1,20 @@
// Verifies that "kcfi" module flag is added.
//
-// needs-sanitizer-kcfi
+// revisions: aarch64 x86_64
+// [aarch64] compile-flags: --target aarch64-unknown-none
+// [aarch64] needs-llvm-components: aarch64
+// [x86_64] compile-flags: --target x86_64-unknown-none
+// [x86_64] needs-llvm-components: x86
// compile-flags: -Ctarget-feature=-crt-static -Zsanitizer=kcfi
+#![feature(no_core, lang_items)]
#![crate_type="lib"]
+#![no_core]
+
+#[lang="sized"]
+trait Sized { }
+#[lang="copy"]
+trait Copy { }
pub fn foo() {
}
diff --git a/tests/codegen/sanitizer/memory-track-origins.rs b/tests/codegen/sanitizer/memory-track-origins.rs
index 4bd50508d..e15a3b227 100644
--- a/tests/codegen/sanitizer/memory-track-origins.rs
+++ b/tests/codegen/sanitizer/memory-track-origins.rs
@@ -4,11 +4,12 @@
// needs-sanitizer-memory
// revisions:MSAN-0 MSAN-1 MSAN-2 MSAN-1-LTO MSAN-2-LTO
//
-//[MSAN-0] compile-flags: -Zsanitizer=memory
-//[MSAN-1] compile-flags: -Zsanitizer=memory -Zsanitizer-memory-track-origins=1
-//[MSAN-2] compile-flags: -Zsanitizer=memory -Zsanitizer-memory-track-origins
-//[MSAN-1-LTO] compile-flags: -Zsanitizer=memory -Zsanitizer-memory-track-origins=1 -C lto=fat
-//[MSAN-2-LTO] compile-flags: -Zsanitizer=memory -Zsanitizer-memory-track-origins -C lto=fat
+// compile-flags: -Zsanitizer=memory -Ctarget-feature=-crt-static
+//[MSAN-0] compile-flags:
+//[MSAN-1] compile-flags: -Zsanitizer-memory-track-origins=1
+//[MSAN-2] compile-flags: -Zsanitizer-memory-track-origins
+//[MSAN-1-LTO] compile-flags: -Zsanitizer-memory-track-origins=1 -C lto=fat
+//[MSAN-2-LTO] compile-flags: -Zsanitizer-memory-track-origins -C lto=fat
#![crate_type="lib"]
diff --git a/tests/codegen/sanitizer/no-sanitize-inlining.rs b/tests/codegen/sanitizer/no-sanitize-inlining.rs
index f4af60bae..e371b19eb 100644
--- a/tests/codegen/sanitizer/no-sanitize-inlining.rs
+++ b/tests/codegen/sanitizer/no-sanitize-inlining.rs
@@ -4,8 +4,9 @@
// needs-sanitizer-address
// needs-sanitizer-leak
// revisions: ASAN LSAN
-//[ASAN] compile-flags: -Zsanitizer=address -C opt-level=3 -Z mir-opt-level=4
-//[LSAN] compile-flags: -Zsanitizer=leak -C opt-level=3 -Z mir-opt-level=4
+// compile-flags: -Copt-level=3 -Zmir-opt-level=4 -Ctarget-feature=-crt-static
+//[ASAN] compile-flags: -Zsanitizer=address
+//[LSAN] compile-flags: -Zsanitizer=leak
#![crate_type="lib"]
#![feature(no_sanitize)]
diff --git a/tests/codegen/sanitizer/no-sanitize.rs b/tests/codegen/sanitizer/no-sanitize.rs
index 783b568e2..d0b692434 100644
--- a/tests/codegen/sanitizer/no-sanitize.rs
+++ b/tests/codegen/sanitizer/no-sanitize.rs
@@ -2,7 +2,7 @@
// selectively disable sanitizer instrumentation.
//
// needs-sanitizer-address
-// compile-flags: -Zsanitizer=address
+// compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static
#![crate_type="lib"]
#![feature(no_sanitize)]
diff --git a/tests/codegen/sanitizer/sanitizer-recover.rs b/tests/codegen/sanitizer/sanitizer-recover.rs
index 7b00fcf8e..59b1fdd64 100644
--- a/tests/codegen/sanitizer/sanitizer-recover.rs
+++ b/tests/codegen/sanitizer/sanitizer-recover.rs
@@ -6,6 +6,7 @@
// revisions:ASAN ASAN-RECOVER MSAN MSAN-RECOVER MSAN-RECOVER-LTO
// no-prefer-dynamic
//
+// compile-flags: -Ctarget-feature=-crt-static
//[ASAN] compile-flags: -Zsanitizer=address -Copt-level=0
//[ASAN-RECOVER] compile-flags: -Zsanitizer=address -Zsanitizer-recover=address -Copt-level=0
//[MSAN] compile-flags: -Zsanitizer=memory
diff --git a/tests/codegen/slice-as_chunks.rs b/tests/codegen/slice-as_chunks.rs
index 48e3f73fc..efac9f3d6 100644
--- a/tests/codegen/slice-as_chunks.rs
+++ b/tests/codegen/slice-as_chunks.rs
@@ -22,9 +22,9 @@ pub fn chunks4(x: &[u8]) -> &[[u8; 4]] {
// CHECK-LABEL: @chunks4_with_remainder
#[no_mangle]
pub fn chunks4_with_remainder(x: &[u8]) -> (&[[u8; 4]], &[u8]) {
- // CHECK: and i64 %x.1, -4
- // CHECK: and i64 %x.1, 3
- // CHECK: lshr exact
+ // CHECK-DAG: and i64 %x.1, -4
+ // CHECK-DAG: and i64 %x.1, 3
+ // CHECK-DAG: lshr
// CHECK-NOT: mul
// CHECK-NOT: udiv
// CHECK-NOT: urem
diff --git a/tests/codegen/slice-iter-nonnull.rs b/tests/codegen/slice-iter-nonnull.rs
index f7d164bc8..8749226d4 100644
--- a/tests/codegen/slice-iter-nonnull.rs
+++ b/tests/codegen/slice-iter-nonnull.rs
@@ -100,13 +100,13 @@ pub fn slice_iter_is_empty(it: &std::slice::Iter<'_, u32>) -> bool {
// CHECK-LABEL: @slice_iter_len
#[no_mangle]
pub fn slice_iter_len(it: &std::slice::Iter<'_, u32>) -> usize {
- // CHECK: %[[START:.+]] = load ptr, ptr %it,
- // CHECK-SAME: !nonnull
- // CHECK-SAME: !noundef
// CHECK: %[[ENDP:.+]] = getelementptr{{.+}}ptr %it,{{.+}} 1
// CHECK: %[[END:.+]] = load ptr, ptr %[[ENDP]]
// CHECK-SAME: !nonnull
// CHECK-SAME: !noundef
+ // CHECK: %[[START:.+]] = load ptr, ptr %it,
+ // CHECK-SAME: !nonnull
+ // CHECK-SAME: !noundef
// CHECK: ptrtoint
// CHECK: ptrtoint
diff --git a/tests/codegen/tuple-layout-opt.rs b/tests/codegen/tuple-layout-opt.rs
index 309fe1d5e..7cc67a9b5 100644
--- a/tests/codegen/tuple-layout-opt.rs
+++ b/tests/codegen/tuple-layout-opt.rs
@@ -1,4 +1,3 @@
-// ignore-emscripten
// compile-flags: -C no-prepopulate-passes -Copt-level=0
// Test that tuples get optimized layout, in particular with a ZST in the last field (#63244)
diff --git a/tests/codegen/vecdeque-nonempty-get-no-panic.rs b/tests/codegen/vecdeque-nonempty-get-no-panic.rs
new file mode 100644
index 000000000..c2877d2d0
--- /dev/null
+++ b/tests/codegen/vecdeque-nonempty-get-no-panic.rs
@@ -0,0 +1,17 @@
+// Guards against regression for optimization discussed in issue #80836
+
+// compile-flags: -O
+// ignore-debug: the debug assertions get in the way
+
+#![crate_type = "lib"]
+
+use std::collections::VecDeque;
+
+// CHECK-LABEL: @front
+// CHECK: ret void
+#[no_mangle]
+pub fn front(v: VecDeque<usize>) {
+ if !v.is_empty() {
+ v.get(0).unwrap();
+ }
+}