mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-01 17:40:16 +00:00
24 lines
816 B
Rust
24 lines
816 B
Rust
//@ add-minicore
|
|
//@ compile-flags: -Copt-level=3
|
|
#![crate_type = "lib"]
|
|
|
|
// Check that `%args` explicitly has its lifetime start and end. Being explicit can improve
|
|
// instruction and register selection, see e.g. https://github.com/rust-lang/rust/pull/144549
|
|
|
|
#[unsafe(no_mangle)]
|
|
unsafe extern "C" fn variadic(a: f64, mut args: ...) -> f64 {
|
|
// CHECK: call void @llvm.lifetime.start.p0({{(i64 [0-9]+, )?}}ptr nonnull %args)
|
|
// CHECK: call void @llvm.va_start.p0(ptr nonnull %args)
|
|
|
|
let b = args.next_arg::<f64>();
|
|
let c = args.next_arg::<f64>();
|
|
|
|
a + b + c
|
|
|
|
// We no longer call the LLVM va_end.
|
|
// CHECK-NOT: call void @llvm.va_end
|
|
|
|
// But we do still explicitly end the lifetime of the VaList.
|
|
// CHECK: call void @llvm.lifetime.end.p0({{(i64 [0-9]+, )?}}ptr nonnull %args)
|
|
}
|