diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:31 +0000 |
commit | dc0db358abe19481e475e10c32149b53370f1a1c (patch) | |
tree | ab8ce99c4b255ce46f99ef402c27916055b899ee /tests/codegen/issues | |
parent | Releasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff) | |
download | rustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip |
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | tests/codegen/issues/issue-105386-ub-in-debuginfo.rs | 7 | ||||
-rw-r--r-- | tests/codegen/issues/issue-111603.rs | 12 | ||||
-rw-r--r-- | tests/codegen/issues/issue-114312.rs | 27 | ||||
-rw-r--r-- | tests/codegen/issues/issue-86106.rs | 4 |
4 files changed, 45 insertions, 5 deletions
diff --git a/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs b/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs index 2ee4d7cca..6e0eacfe4 100644 --- a/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs +++ b/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs @@ -1,4 +1,5 @@ -// compile-flags: --crate-type=lib -O -Cdebuginfo=2 -Cno-prepopulate-passes +// compile-flags: --crate-type=lib -O -Cdebuginfo=2 -Cno-prepopulate-passes -Zmir-enable-passes=-ScalarReplacementOfAggregates +// MIR SROA will decompose the closure // min-llvm-version: 15.0 # this test uses opaque pointer notation #![feature(stmt_expr_attributes)] @@ -15,8 +16,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}}:10:23: 10:25]" +// CHECK-NOT: [[ptr_tmp:%.*]] = getelementptr inbounds %"[closure@{{.*.rs}}:10:23: 10: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-111603.rs b/tests/codegen/issues/issue-111603.rs index 90b3c314d..06429ed3f 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/issues/issue-114312.rs b/tests/codegen/issues/issue-114312.rs new file mode 100644 index 000000000..28b029a8b --- /dev/null +++ b/tests/codegen/issues/issue-114312.rs @@ -0,0 +1,27 @@ +// compile-flags: -O +// min-system-llvm-version: 17 +// only-x86_64-unknown-linux-gnu + +// We want to check that this function does not mis-optimize to loop jumping. + +#![crate_type = "lib"] + +#[repr(C)] +pub enum Expr { + Sum, + // must have more than usize data + Sub(usize, u8), +} + +#[no_mangle] +pub extern "C" fn issue_114312(expr: Expr) { + // CHECK-LABEL: @issue_114312( + // CHECK-NOT: readonly + // CHECK-SAME: byval + // CHECK-NEXT: start: + // CHECK-NEXT: ret void + match expr { + Expr::Sum => {} + Expr::Sub(_, _) => issue_114312(Expr::Sum), + } +} diff --git a/tests/codegen/issues/issue-86106.rs b/tests/codegen/issues/issue-86106.rs index c0be7fab2..be5034dcf 100644 --- a/tests/codegen/issues/issue-86106.rs +++ b/tests/codegen/issues/issue-86106.rs @@ -7,7 +7,7 @@ #![crate_type = "lib"] -// CHECK-LABEL: define void @string_new +// CHECK-LABEL: define {{(dso_local )?}}void @string_new #[no_mangle] pub fn string_new() -> String { // CHECK: store ptr inttoptr @@ -17,7 +17,7 @@ pub fn string_new() -> String { String::new() } -// CHECK-LABEL: define void @empty_to_string +// CHECK-LABEL: define {{(dso_local )?}}void @empty_to_string #[no_mangle] pub fn empty_to_string() -> String { // CHECK: store ptr inttoptr |