]> git.lizzy.rs Git - rust.git/blob - tests/codegen/issue-105386-ub-in-debuginfo.rs
Auto merge of #107778 - weihanglo:update-cargo, r=weihanglo
[rust.git] / tests / codegen / issue-105386-ub-in-debuginfo.rs
1 // compile-flags: --crate-type=lib -O -Cdebuginfo=2 -Cno-prepopulate-passes
2 // min-llvm-version: 15.0 # this test uses opaque pointer notation
3 #![feature(stmt_expr_attributes)]
4
5 pub struct S([usize; 8]);
6
7 #[no_mangle]
8 pub fn outer_function(x: S, y: S) -> usize {
9     (#[inline(always)]|| {
10         let _z = x;
11         y.0[0]
12     })()
13 }
14
15 // Check that we do not attempt to load from the spilled arg before it is assigned to
16 // when generating debuginfo.
17 // CHECK-LABEL: @outer_function
18 // CHECK: [[spill:%.*]] = alloca %"[closure@{{.*.rs}}:9:23: 9:25]"
19 // CHECK-NOT: [[ptr_tmp:%.*]] = getelementptr inbounds %"[closure@{{.*.rs}}:9:23: 9:25]", ptr [[spill]]
20 // CHECK-NOT: [[load:%.*]] = load ptr, ptr
21 // CHECK: call void @llvm.lifetime.start{{.*}}({{.*}}, ptr [[spill]])
22 // CHECK: call void @llvm.memcpy{{.*}}(ptr {{align .*}} [[spill]], ptr {{align .*}} %x