]> git.lizzy.rs Git - rust.git/blob - tests/codegen/issue-98156-const-arg-temp-lifetime.rs
Rollup merge of #106470 - ehuss:tidy-no-wasm, r=Mark-Simulacrum
[rust.git] / tests / codegen / issue-98156-const-arg-temp-lifetime.rs
1 // This test checks that temporaries for indirectly-passed arguments get lifetime markers.
2
3 // compile-flags: -O -C no-prepopulate-passes -Zmir-opt-level=0
4
5 #![crate_type = "lib"]
6
7 extern "Rust" {
8     fn f(x: [u8; 1024]);
9 }
10
11 const A: [u8; 1024] = [0; 1024];
12
13 // CHECK-LABEL: @const_arg_indirect
14 #[no_mangle]
15 pub unsafe fn const_arg_indirect() {
16     // Ensure that the live ranges for the two argument temporaries don't overlap.
17
18     // CHECK: call void @llvm.lifetime.start
19     // CHECK: call void @f
20     // CHECK: call void @llvm.lifetime.end
21     // CHECK: call void @llvm.lifetime.start
22     // CHECK: call void @f
23     // CHECK: call void @llvm.lifetime.end
24
25     f(A);
26     f(A);
27 }