mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-19 11:12:43 +00:00
Add more codegen tests
This commit is contained in:
parent
af23ad93cd
commit
f1255380ac
@ -3,7 +3,7 @@
|
||||
// of the sysv64 abi.
|
||||
//
|
||||
// needs-llvm-components: x86
|
||||
// compile-flags: -C no-prepopulate-passes --target=x86_64-unknown-linux-gnu
|
||||
// compile-flags: -C no-prepopulate-passes --target=x86_64-unknown-linux-gnu -Copt-level=0
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#![no_core]
|
||||
@ -15,7 +15,7 @@ trait Sized {}
|
||||
trait Copy {}
|
||||
impl Copy for i64 {}
|
||||
|
||||
// CHECK: define x86_64_sysvcc noundef i64 @has_sysv64_abi
|
||||
// CHECK: define x86_64_sysvcc i64 @has_sysv64_abi
|
||||
#[no_mangle]
|
||||
pub extern "sysv64" fn has_sysv64_abi(a: i64) -> i64 {
|
||||
a
|
||||
|
@ -3,7 +3,7 @@
|
||||
// of the x86-interrupt abi.
|
||||
|
||||
// needs-llvm-components: x86
|
||||
// compile-flags: -C no-prepopulate-passes --target=x86_64-unknown-linux-gnu
|
||||
// compile-flags: -C no-prepopulate-passes --target=x86_64-unknown-linux-gnu -Copt-level=0
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#![no_core]
|
||||
@ -15,7 +15,7 @@ trait Sized {}
|
||||
trait Copy {}
|
||||
impl Copy for i64 {}
|
||||
|
||||
// CHECK: define x86_intrcc noundef i64 @has_x86_interrupt_abi
|
||||
// CHECK: define x86_intrcc i64 @has_x86_interrupt_abi
|
||||
#[no_mangle]
|
||||
pub extern "x86-interrupt" fn has_x86_interrupt_abi(a: i64) -> i64 {
|
||||
a
|
||||
|
@ -1,9 +1,9 @@
|
||||
// compile-flags: -C no-prepopulate-passes
|
||||
// compile-flags: -C no-prepopulate-passes -Copt-level=0
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
// Hack to get the correct size for the length part in slices
|
||||
// CHECK: @helper([[USIZE:i[0-9]+]] noundef %_1)
|
||||
// CHECK: @helper([[USIZE:i[0-9]+]] %_1)
|
||||
#[no_mangle]
|
||||
pub fn helper(_: usize) {
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
// ignore-wasm32-bare compiled with panic=abort by default
|
||||
// compile-flags: -C no-prepopulate-passes
|
||||
// compile-flags: -C no-prepopulate-passes -Copt-level=0
|
||||
//
|
||||
|
||||
#![crate_type = "lib"]
|
||||
@ -15,7 +15,7 @@ extern "C" {
|
||||
|
||||
pub unsafe extern "C" fn use_foreign_c_variadic_0() {
|
||||
// Ensure that we correctly call foreign C-variadic functions.
|
||||
// CHECK: call void (i32, ...) @foreign_c_variadic_0([[PARAM:i32 noundef( signext)?]] 0)
|
||||
// CHECK: call void (i32, ...) @foreign_c_variadic_0([[PARAM:i32( signext)?]] 0)
|
||||
foreign_c_variadic_0(0);
|
||||
// CHECK: call void (i32, ...) @foreign_c_variadic_0([[PARAM]] 0, [[PARAM]] 42)
|
||||
foreign_c_variadic_0(0, 42i32);
|
||||
@ -61,7 +61,7 @@ pub unsafe extern "C" fn c_variadic(n: i32, mut ap: ...) -> i32 {
|
||||
// Ensure that we generate the correct `call` signature when calling a Rust
|
||||
// defined C-variadic.
|
||||
pub unsafe fn test_c_variadic_call() {
|
||||
// CHECK: call [[RET:noundef( signext)? i32]] (i32, ...) @c_variadic([[PARAM]] 0)
|
||||
// CHECK: call [[RET:(signext )?i32]] (i32, ...) @c_variadic([[PARAM]] 0)
|
||||
c_variadic(0);
|
||||
// CHECK: call [[RET]] (i32, ...) @c_variadic([[PARAM]] 0, [[PARAM]] 42)
|
||||
c_variadic(0, 42i32);
|
||||
|
@ -1,4 +1,4 @@
|
||||
// compile-flags: -C no-prepopulate-passes
|
||||
// compile-flags: -C no-prepopulate-passes -Copt-level=0
|
||||
|
||||
// ignore-riscv64
|
||||
|
||||
@ -23,7 +23,7 @@ pub fn do_call() {
|
||||
|
||||
unsafe {
|
||||
// Ensure that we `call` LLVM intrinsics instead of trying to `invoke` them
|
||||
// CHECK: call noundef float @llvm.sqrt.f32(float noundef 4.000000e+00
|
||||
// CHECK: call float @llvm.sqrt.f32(float 4.000000e+00
|
||||
sqrt(4.0);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// This test is for *-windows-msvc only.
|
||||
// This test is for *-windows-msvc only.
|
||||
// only-windows
|
||||
// ignore-gnu
|
||||
|
||||
@ -15,10 +15,10 @@ extern crate wrapper;
|
||||
// CHECK: @static_global1 = external local_unnamed_addr global i32
|
||||
// CHECK: @static_global2 = external local_unnamed_addr global i32
|
||||
|
||||
// CHECK: declare dllimport i32 @dylib_func1(i32)
|
||||
// CHECK: declare dllimport i32 @dylib_func2(i32)
|
||||
// CHECK: declare i32 @static_func1(i32)
|
||||
// CHECK: declare i32 @static_func2(i32)
|
||||
// CHECK: declare dllimport noundef i32 @dylib_func1(i32 noundef)
|
||||
// CHECK: declare dllimport noundef i32 @dylib_func2(i32 noundef)
|
||||
// CHECK: declare noundef i32 @static_func1(i32 noundef)
|
||||
// CHECK: declare noundef i32 @static_func2(i32 noundef)
|
||||
|
||||
#[link(name = "dummy", kind="dylib")]
|
||||
extern "C" {
|
||||
|
@ -1,4 +1,4 @@
|
||||
// compile-flags: --crate-type=rlib
|
||||
// compile-flags: --crate-type=rlib -Copt-level=0
|
||||
// revisions: aarch64-apple aarch64-linux force x64-apple x64-linux
|
||||
// [aarch64-apple] needs-llvm-components: aarch64
|
||||
// [aarch64-apple] compile-flags: --target=aarch64-apple-darwin
|
||||
@ -20,7 +20,7 @@ trait Copy { }
|
||||
impl Copy for u32 {}
|
||||
|
||||
|
||||
// CHECK: define noundef i32 @peach{{.*}}[[PEACH_ATTRS:\#[0-9]+]] {
|
||||
// CHECK: define i32 @peach{{.*}}[[PEACH_ATTRS:\#[0-9]+]] {
|
||||
#[no_mangle]
|
||||
pub fn peach(x: u32) -> u32 {
|
||||
x
|
||||
|
@ -1,11 +1,11 @@
|
||||
// compile-flags: -O -C no-prepopulate-passes
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
use std::mem::MaybeUninit;
|
||||
use std::num::NonZeroU64;
|
||||
use std::marker::PhantomPinned;
|
||||
use std::ptr::NonNull;
|
||||
|
||||
pub struct S {
|
||||
_field: [i32; 8],
|
||||
@ -138,11 +138,27 @@ pub fn indirect_struct(_: S) {
|
||||
pub fn borrowed_struct(_: &S) {
|
||||
}
|
||||
|
||||
// CHECK: @option_borrow({{i32\*|ptr}} noalias noundef readonly align 4 dereferenceable_or_null(4) %x)
|
||||
#[no_mangle]
|
||||
pub fn option_borrow(x: Option<&i32>) {
|
||||
}
|
||||
|
||||
// CHECK: @option_borrow_mut({{i32\*|ptr}} noalias noundef align 4 dereferenceable_or_null(4) %x)
|
||||
#[no_mangle]
|
||||
pub fn option_borrow_mut(x: Option<&mut i32>) {
|
||||
}
|
||||
|
||||
// CHECK: @raw_struct({{%S\*|ptr}} noundef %_1)
|
||||
#[no_mangle]
|
||||
pub fn raw_struct(_: *const S) {
|
||||
}
|
||||
|
||||
// CHECK: @raw_option_nonnull_struct({{i32\*|ptr}} noundef %_1)
|
||||
#[no_mangle]
|
||||
pub fn raw_option_nonnull_struct(_: Option<NonNull<S>>) {
|
||||
}
|
||||
|
||||
|
||||
// `Box` can get deallocated during execution of the function, so it should
|
||||
// not get `dereferenceable`.
|
||||
// CHECK: noundef nonnull align 4 {{i32\*|ptr}} @_box({{i32\*|ptr}} noalias noundef nonnull align 4 %x)
|
||||
@ -200,6 +216,16 @@ pub fn str(_: &[u8]) {
|
||||
pub fn trait_borrow(_: &dyn Drop) {
|
||||
}
|
||||
|
||||
// CHECK: @option_trait_borrow({{i8\*|ptr}} noundef align 1 %x.0, {{i8\*|ptr}} %x.1)
|
||||
#[no_mangle]
|
||||
pub fn option_trait_borrow(x: Option<&dyn Drop>) {
|
||||
}
|
||||
|
||||
// CHECK: @option_trait_borrow_mut({{i8\*|ptr}} noundef align 1 %x.0, {{i8\*|ptr}} %x.1)
|
||||
#[no_mangle]
|
||||
pub fn option_trait_borrow_mut(x: Option<&mut dyn Drop>) {
|
||||
}
|
||||
|
||||
// CHECK: @trait_raw({{\{\}\*|ptr}} noundef %_1.0, {{.+}} noalias noundef readonly align {{.*}} dereferenceable({{.*}}) %_1.1)
|
||||
#[no_mangle]
|
||||
pub fn trait_raw(_: *const dyn Drop) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
// compile-flags: -C no-prepopulate-passes
|
||||
// compile-flags: -C no-prepopulate-passes -Copt-level=0
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#![feature(const_eval_select)]
|
||||
@ -13,6 +13,6 @@ pub fn hi(n: i32) -> i32 { n }
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe fn hey() {
|
||||
// CHECK: call noundef i32 @hi(i32
|
||||
// CHECK: call i32 @hi(i32
|
||||
const_eval_select((42,), foo, hi);
|
||||
}
|
||||
|
@ -1,11 +1,12 @@
|
||||
// compile-flags: -Copt-level=0
|
||||
#![crate_type = "lib"]
|
||||
#![feature(core_intrinsics)]
|
||||
|
||||
// CHECK-LABEL: @mask_ptr
|
||||
// CHECK-SAME: [[WORD:i[0-9]+]] noundef %mask
|
||||
// CHECK-SAME: [[WORD:i[0-9]+]] %mask
|
||||
#[no_mangle]
|
||||
pub fn mask_ptr(ptr: *const u16, mask: usize) -> *const u16 {
|
||||
// CHECK: call
|
||||
// CHECK-SAME: @llvm.ptrmask.{{p0|p0i8}}.[[WORD]]({{ptr|i8\*}} {{%ptr|%0}}, [[WORD]] %mask)
|
||||
// CHECK-SAME: @llvm.ptrmask.{{p0|p0i8}}.[[WORD]]({{ptr|i8\*}} {{%ptr|%1}}, [[WORD]] %mask)
|
||||
core::intrinsics::ptr_mask(ptr, mask)
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
// compile-flags: -C no-prepopulate-passes
|
||||
// compile-flags: -C no-prepopulate-passes -Copt-level=0
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
#[no_mangle]
|
||||
pub struct F32(f32);
|
||||
|
||||
// CHECK: define{{.*}}float @add_newtype_f32(float noundef %a, float noundef %b)
|
||||
// CHECK: define{{.*}}float @add_newtype_f32(float %a, float %b)
|
||||
#[inline(never)]
|
||||
#[no_mangle]
|
||||
pub fn add_newtype_f32(a: F32, b: F32) -> F32 {
|
||||
@ -15,7 +15,7 @@ pub fn add_newtype_f32(a: F32, b: F32) -> F32 {
|
||||
#[no_mangle]
|
||||
pub struct F64(f64);
|
||||
|
||||
// CHECK: define{{.*}}double @add_newtype_f64(double noundef %a, double noundef %b)
|
||||
// CHECK: define{{.*}}double @add_newtype_f64(double %a, double %b)
|
||||
#[inline(never)]
|
||||
#[no_mangle]
|
||||
pub fn add_newtype_f64(a: F64, b: F64) -> F64 {
|
||||
|
@ -1,4 +1,4 @@
|
||||
// compile-flags: -C no-prepopulate-passes
|
||||
// compile-flags: -C no-prepopulate-passes -Copt-level=0
|
||||
//
|
||||
// only-x86_64
|
||||
// ignore-windows
|
||||
@ -16,6 +16,6 @@ struct Bar(u64, u64, u64);
|
||||
|
||||
// Ensure that emit arguments of the correct type.
|
||||
pub unsafe fn test_call_variadic() {
|
||||
// CHECK: call void (i32, ...) @variadic_fn(i32 noundef 0, i8 {{.*}}, {{%Bar\*|ptr}} {{.*}})
|
||||
// CHECK: call void (i32, ...) @variadic_fn(i32 0, i8 {{.*}}, {{%Bar\*|ptr}} {{.*}})
|
||||
variadic_fn(0, Foo(0), Bar(0, 0, 0))
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ pub fn iter_repeat_n_next(it: &mut std::iter::RepeatN<NotCopy>) -> Option<NotCop
|
||||
#[no_mangle]
|
||||
// CHECK-LABEL: @vec_extend_via_iter_repeat_n
|
||||
pub fn vec_extend_via_iter_repeat_n() -> Vec<u8> {
|
||||
// CHECK: %[[ADDR:.+]] = tail call dereferenceable_or_null(1234) ptr @__rust_alloc(i64 1234, i64 1)
|
||||
// CHECK: %[[ADDR:.+]] = tail call noundef dereferenceable_or_null(1234) ptr @__rust_alloc(i64 noundef 1234, i64 noundef 1)
|
||||
// CHECK: tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(1234) %[[ADDR]], i8 42, i64 1234,
|
||||
|
||||
let n = 1234_usize;
|
||||
|
@ -51,7 +51,7 @@ pub fn load_scalar_pair<'a>(x: &(&'a i32, &'a Align16)) -> (&'a i32, &'a Align16
|
||||
#[no_mangle]
|
||||
pub fn load_raw_pointer<'a>(x: &*const i32) -> *const i32 {
|
||||
// loaded raw pointer should not have !nonnull or !align metadata
|
||||
// CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %x, align [[PTR_ALIGNMENT]], !noundef !2{{$}}
|
||||
// CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %x, align [[PTR_ALIGNMENT]], !noundef ![[NOUNDEF:[0-9]+]]{{$}}
|
||||
*x
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ pub fn load_maybeuninit_enum_bool(x: &MaybeUninit<MyBool>) -> MaybeUninit<MyBool
|
||||
// CHECK-LABEL: @load_int
|
||||
#[no_mangle]
|
||||
pub fn load_int(x: &u16) -> u16 {
|
||||
// CHECK: load i16, {{i16\*|ptr}} %x, align 2, !noundef !2{{$}}
|
||||
// CHECK: load i16, {{i16\*|ptr}} %x, align 2, !noundef ![[NOUNDEF]]{{$}}
|
||||
*x
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ pub fn load_nonzero_int(x: &NonZeroU16) -> NonZeroU16 {
|
||||
// CHECK-LABEL: @load_option_nonzero_int
|
||||
#[no_mangle]
|
||||
pub fn load_option_nonzero_int(x: &Option<NonZeroU16>) -> Option<NonZeroU16> {
|
||||
// CHECK: load i16, {{i16\*|ptr}} %x, align 2, !noundef !2{{$}}
|
||||
// CHECK: load i16, {{i16\*|ptr}} %x, align 2, !noundef ![[NOUNDEF]]{{$}}
|
||||
*x
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// compile-flags: -C no-prepopulate-passes
|
||||
// compile-flags: -C no-prepopulate-passes -Copt-level=0
|
||||
// needs-asm-support
|
||||
// only-x86_64
|
||||
|
||||
@ -19,7 +19,7 @@ pub unsafe extern "C" fn naked_empty() {
|
||||
}
|
||||
|
||||
// CHECK: Function Attrs: naked
|
||||
// CHECK-NEXT: define{{.*}}i{{[0-9]+}} @naked_with_args_and_return(i64 noundef %a, i64 noundef %b)
|
||||
// CHECK-NEXT: define{{.*}}i{{[0-9]+}} @naked_with_args_and_return(i64 %a, i64 %b)
|
||||
#[no_mangle]
|
||||
#[naked]
|
||||
pub unsafe extern "C" fn naked_with_args_and_return(a: isize, b: isize) -> isize {
|
||||
|
@ -1,8 +1,8 @@
|
||||
// compile-flags: -C relocation-model=pic
|
||||
// compile-flags: -C relocation-model=pic -Copt-level=0
|
||||
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
// CHECK: define noundef i8 @call_foreign_fn()
|
||||
// CHECK: define i8 @call_foreign_fn()
|
||||
#[no_mangle]
|
||||
pub fn call_foreign_fn() -> u8 {
|
||||
unsafe {
|
||||
@ -13,7 +13,7 @@ pub fn call_foreign_fn() -> u8 {
|
||||
// (Allow but do not require `zeroext` here, because it is not worth effort to
|
||||
// spell out which targets have it and which ones do not; see rust#97800.)
|
||||
|
||||
// CHECK: declare noundef{{( zeroext)?}} i8 @foreign_fn()
|
||||
// CHECK: declare{{( zeroext)?}} i8 @foreign_fn()
|
||||
extern "C" {fn foreign_fn() -> u8;}
|
||||
|
||||
// CHECK: !{i32 {{[78]}}, !"PIC Level", i32 2}
|
||||
|
@ -1,11 +1,11 @@
|
||||
// compile-flags: -C relocation-model=pie
|
||||
// compile-flags: -C relocation-model=pie -Copt-level=0
|
||||
// only-x86_64-unknown-linux-gnu
|
||||
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
// With PIE we know local functions cannot be interpositioned, we can mark them
|
||||
// as dso_local.
|
||||
// CHECK: define dso_local noundef i8 @call_foreign_fn()
|
||||
// CHECK: define dso_local i8 @call_foreign_fn()
|
||||
#[no_mangle]
|
||||
pub fn call_foreign_fn() -> u8 {
|
||||
unsafe {
|
||||
@ -15,7 +15,7 @@ pub fn call_foreign_fn() -> u8 {
|
||||
|
||||
// External functions are still marked as non-dso_local, since we don't know if the symbol
|
||||
// is defined in the binary or in the shared library.
|
||||
// CHECK: declare noundef zeroext i8 @foreign_fn()
|
||||
// CHECK: declare zeroext i8 @foreign_fn()
|
||||
extern "C" {fn foreign_fn() -> u8;}
|
||||
|
||||
// CHECK: !{i32 {{[78]}}, !"PIC Level", i32 2}
|
||||
|
@ -1,9 +1,9 @@
|
||||
// compile-flags: -C no-prepopulate-passes -Zmir-opt-level=0
|
||||
// compile-flags: -C no-prepopulate-passes -Zmir-opt-level=0 -Copt-level=0
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
// Hack to get the correct size for the length part in slices
|
||||
// CHECK: @helper([[USIZE:i[0-9]+]] noundef %_1)
|
||||
// CHECK: @helper([[USIZE:i[0-9]+]] %_1)
|
||||
#[no_mangle]
|
||||
pub fn helper(_: usize) {
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Verifies that pointer type membership tests for indirect calls are emitted.
|
||||
//
|
||||
// needs-sanitizer-cfi
|
||||
// compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi
|
||||
// compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0
|
||||
|
||||
#![crate_type="lib"]
|
||||
|
||||
@ -11,7 +11,7 @@ pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 {
|
||||
// CHECK: [[TT:%.+]] = call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%0}}, metadata !"{{[[:print:]]+}}")
|
||||
// CHECK-NEXT: br i1 [[TT]], label %type_test.pass, label %type_test.fail
|
||||
// CHECK: type_test.pass:
|
||||
// CHECK-NEXT: {{%.+}} = call noundef i32 %f(i32 noundef %arg)
|
||||
// CHECK-NEXT: {{%.+}} = call i32 %f(i32 %arg)
|
||||
// CHECK-NEXT: br label %bb1
|
||||
// CHECK: type_test.fail:
|
||||
// CHECK-NEXT: call void @llvm.trap()
|
||||
|
@ -5,7 +5,7 @@
|
||||
// [aarch64] needs-llvm-components: aarch64
|
||||
// [x86_64] compile-flags: --target x86_64-unknown-none
|
||||
// [x86_64] needs-llvm-components:
|
||||
// compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi
|
||||
// compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0
|
||||
|
||||
#![crate_type="lib"]
|
||||
#![feature(no_core, lang_items)]
|
||||
@ -21,21 +21,21 @@ impl Copy for i32 {}
|
||||
pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 {
|
||||
// CHECK-LABEL: define{{.*}}foo
|
||||
// CHECK-SAME: {{.*}}!{{<unknown kind #36>|kcfi_type}} ![[TYPE1:[0-9]+]]
|
||||
// CHECK: call noundef i32 %f(i32 noundef %arg){{.*}}[ "kcfi"(i32 -1666898348) ]
|
||||
// CHECK: call i32 %f(i32 %arg){{.*}}[ "kcfi"(i32 -1666898348) ]
|
||||
f(arg)
|
||||
}
|
||||
|
||||
pub fn bar(f: fn(i32, i32) -> i32, arg1: i32, arg2: i32) -> i32 {
|
||||
// CHECK-LABEL: define{{.*}}bar
|
||||
// CHECK-SAME: {{.*}}!{{<unknown kind #36>|kcfi_type}} ![[TYPE2:[0-9]+]]
|
||||
// CHECK: call noundef i32 %f(i32 noundef %arg1, i32 noundef %arg2){{.*}}[ "kcfi"(i32 -1789026986) ]
|
||||
// CHECK: call i32 %f(i32 %arg1, i32 %arg2){{.*}}[ "kcfi"(i32 -1789026986) ]
|
||||
f(arg1, arg2)
|
||||
}
|
||||
|
||||
pub fn baz(f: fn(i32, i32, i32) -> i32, arg1: i32, arg2: i32, arg3: i32) -> i32 {
|
||||
// CHECK-LABEL: define{{.*}}baz
|
||||
// CHECK-SAME: {{.*}}!{{<unknown kind #36>|kcfi_type}} ![[TYPE3:[0-9]+]]
|
||||
// CHECK: call noundef i32 %f(i32 noundef %arg1, i32 noundef %arg2, i32 noundef %arg3){{.*}}[ "kcfi"(i32 1248878270) ]
|
||||
// CHECK: call i32 %f(i32 %arg1, i32 %arg2, i32 %arg3){{.*}}[ "kcfi"(i32 1248878270) ]
|
||||
f(arg1, arg2, arg3)
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
// revisions:ASAN ASAN-RECOVER MSAN MSAN-RECOVER MSAN-RECOVER-LTO
|
||||
// no-prefer-dynamic
|
||||
//
|
||||
//[ASAN] compile-flags: -Zsanitizer=address
|
||||
//[ASAN-RECOVER] compile-flags: -Zsanitizer=address -Zsanitizer-recover=address
|
||||
//[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
|
||||
//[MSAN-RECOVER] compile-flags: -Zsanitizer=memory -Zsanitizer-recover=memory
|
||||
//[MSAN-RECOVER-LTO] compile-flags: -Zsanitizer=memory -Zsanitizer-recover=memory -C lto=fat
|
||||
@ -16,12 +16,12 @@
|
||||
// MSAN-RECOVER: @__msan_keep_going = weak_odr {{.*}}constant i32 1
|
||||
// MSAN-RECOVER-LTO: @__msan_keep_going = weak_odr {{.*}}constant i32 1
|
||||
|
||||
// ASAN-LABEL: define dso_local noundef i32 @penguin(
|
||||
// ASAN-LABEL: define dso_local i32 @penguin(
|
||||
// ASAN: call void @__asan_report_load4(i64 %0)
|
||||
// ASAN: unreachable
|
||||
// ASAN: }
|
||||
//
|
||||
// ASAN-RECOVER-LABEL: define dso_local noundef i32 @penguin(
|
||||
// ASAN-RECOVER-LABEL: define dso_local i32 @penguin(
|
||||
// ASAN-RECOVER: call void @__asan_report_load4_noabort(
|
||||
// ASAN-RECOVER-NOT: unreachable
|
||||
// ASAN: }
|
||||
|
@ -1,4 +1,4 @@
|
||||
// compile-flags: -Cno-prepopulate-passes
|
||||
// compile-flags: -Cno-prepopulate-passes -Copt-level=0
|
||||
|
||||
// revisions:x86_64 i686 aarch64-apple aarch64-windows aarch64-linux arm riscv
|
||||
|
||||
@ -31,85 +31,85 @@
|
||||
// The patterns in this file are written in the style of a table to make the
|
||||
// uniformities and distinctions more apparent.
|
||||
//
|
||||
// ZERO/SIGN-EXTENDING TO 32 BITS NON-EXTENDING
|
||||
// ====================================== ===============================
|
||||
// x86_64: void @c_arg_u8(i8 noundef zeroext %_a)
|
||||
// i686: void @c_arg_u8(i8 noundef zeroext %_a)
|
||||
// aarch64-apple: void @c_arg_u8(i8 noundef zeroext %_a)
|
||||
// aarch64-windows: void @c_arg_u8(i8 noundef %_a)
|
||||
// aarch64-linux: void @c_arg_u8(i8 noundef %_a)
|
||||
// arm: void @c_arg_u8(i8 noundef zeroext %_a)
|
||||
// riscv: void @c_arg_u8(i8 noundef zeroext %_a)
|
||||
// ZERO/SIGN-EXTENDING TO 32 BITS NON-EXTENDING
|
||||
// ============================== =======================
|
||||
// x86_64: void @c_arg_u8(i8 zeroext %_a)
|
||||
// i686: void @c_arg_u8(i8 zeroext %_a)
|
||||
// aarch64-apple: void @c_arg_u8(i8 zeroext %_a)
|
||||
// aarch64-windows: void @c_arg_u8(i8 %_a)
|
||||
// aarch64-linux: void @c_arg_u8(i8 %_a)
|
||||
// arm: void @c_arg_u8(i8 zeroext %_a)
|
||||
// riscv: void @c_arg_u8(i8 zeroext %_a)
|
||||
#[no_mangle] pub extern "C" fn c_arg_u8(_a: u8) { }
|
||||
|
||||
// x86_64: void @c_arg_u16(i16 noundef zeroext %_a)
|
||||
// i686: void @c_arg_u16(i16 noundef zeroext %_a)
|
||||
// aarch64-apple: void @c_arg_u16(i16 noundef zeroext %_a)
|
||||
// aarch64-windows: void @c_arg_u16(i16 noundef %_a)
|
||||
// aarch64-linux: void @c_arg_u16(i16 noundef %_a)
|
||||
// arm: void @c_arg_u16(i16 noundef zeroext %_a)
|
||||
// riscv: void @c_arg_u16(i16 noundef zeroext %_a)
|
||||
// x86_64: void @c_arg_u16(i16 zeroext %_a)
|
||||
// i686: void @c_arg_u16(i16 zeroext %_a)
|
||||
// aarch64-apple: void @c_arg_u16(i16 zeroext %_a)
|
||||
// aarch64-windows: void @c_arg_u16(i16 %_a)
|
||||
// aarch64-linux: void @c_arg_u16(i16 %_a)
|
||||
// arm: void @c_arg_u16(i16 zeroext %_a)
|
||||
// riscv: void @c_arg_u16(i16 zeroext %_a)
|
||||
#[no_mangle] pub extern "C" fn c_arg_u16(_a: u16) { }
|
||||
|
||||
// x86_64: void @c_arg_u32(i32 noundef %_a)
|
||||
// i686: void @c_arg_u32(i32 noundef %_a)
|
||||
// aarch64-apple: void @c_arg_u32(i32 noundef %_a)
|
||||
// aarch64-windows: void @c_arg_u32(i32 noundef %_a)
|
||||
// aarch64-linux: void @c_arg_u32(i32 noundef %_a)
|
||||
// arm: void @c_arg_u32(i32 noundef %_a)
|
||||
// riscv: void @c_arg_u32(i32 noundef signext %_a)
|
||||
// x86_64: void @c_arg_u32(i32 %_a)
|
||||
// i686: void @c_arg_u32(i32 %_a)
|
||||
// aarch64-apple: void @c_arg_u32(i32 %_a)
|
||||
// aarch64-windows: void @c_arg_u32(i32 %_a)
|
||||
// aarch64-linux: void @c_arg_u32(i32 %_a)
|
||||
// arm: void @c_arg_u32(i32 %_a)
|
||||
// riscv: void @c_arg_u32(i32 signext %_a)
|
||||
#[no_mangle] pub extern "C" fn c_arg_u32(_a: u32) { }
|
||||
|
||||
// x86_64: void @c_arg_u64(i64 noundef %_a)
|
||||
// i686: void @c_arg_u64(i64 noundef %_a)
|
||||
// aarch64-apple: void @c_arg_u64(i64 noundef %_a)
|
||||
// aarch64-windows: void @c_arg_u64(i64 noundef %_a)
|
||||
// aarch64-linux: void @c_arg_u64(i64 noundef %_a)
|
||||
// arm: void @c_arg_u64(i64 noundef %_a)
|
||||
// riscv: void @c_arg_u64(i64 noundef %_a)
|
||||
// x86_64: void @c_arg_u64(i64 %_a)
|
||||
// i686: void @c_arg_u64(i64 %_a)
|
||||
// aarch64-apple: void @c_arg_u64(i64 %_a)
|
||||
// aarch64-windows: void @c_arg_u64(i64 %_a)
|
||||
// aarch64-linux: void @c_arg_u64(i64 %_a)
|
||||
// arm: void @c_arg_u64(i64 %_a)
|
||||
// riscv: void @c_arg_u64(i64 %_a)
|
||||
#[no_mangle] pub extern "C" fn c_arg_u64(_a: u64) { }
|
||||
|
||||
// x86_64: void @c_arg_i8(i8 noundef signext %_a)
|
||||
// i686: void @c_arg_i8(i8 noundef signext %_a)
|
||||
// aarch64-apple: void @c_arg_i8(i8 noundef signext %_a)
|
||||
// aarch64-windows: void @c_arg_i8(i8 noundef %_a)
|
||||
// aarch64-linux: void @c_arg_i8(i8 noundef %_a)
|
||||
// arm: void @c_arg_i8(i8 noundef signext %_a)
|
||||
// riscv: void @c_arg_i8(i8 noundef signext %_a)
|
||||
// x86_64: void @c_arg_i8(i8 signext %_a)
|
||||
// i686: void @c_arg_i8(i8 signext %_a)
|
||||
// aarch64-apple: void @c_arg_i8(i8 signext %_a)
|
||||
// aarch64-windows: void @c_arg_i8(i8 %_a)
|
||||
// aarch64-linux: void @c_arg_i8(i8 %_a)
|
||||
// arm: void @c_arg_i8(i8 signext %_a)
|
||||
// riscv: void @c_arg_i8(i8 signext %_a)
|
||||
#[no_mangle] pub extern "C" fn c_arg_i8(_a: i8) { }
|
||||
|
||||
// x86_64: void @c_arg_i16(i16 noundef signext %_a)
|
||||
// i686: void @c_arg_i16(i16 noundef signext %_a)
|
||||
// aarch64-apple: void @c_arg_i16(i16 noundef signext %_a)
|
||||
// aarch64-windows: void @c_arg_i16(i16 noundef %_a)
|
||||
// aarch64-linux: void @c_arg_i16(i16 noundef %_a)
|
||||
// arm: void @c_arg_i16(i16 noundef signext %_a)
|
||||
// riscv: void @c_arg_i16(i16 noundef signext %_a)
|
||||
// x86_64: void @c_arg_i16(i16 signext %_a)
|
||||
// i686: void @c_arg_i16(i16 signext %_a)
|
||||
// aarch64-apple: void @c_arg_i16(i16 signext %_a)
|
||||
// aarch64-windows: void @c_arg_i16(i16 %_a)
|
||||
// aarch64-linux: void @c_arg_i16(i16 %_a)
|
||||
// arm: void @c_arg_i16(i16 signext %_a)
|
||||
// riscv: void @c_arg_i16(i16 signext %_a)
|
||||
#[no_mangle] pub extern "C" fn c_arg_i16(_a: i16) { }
|
||||
|
||||
// x86_64: void @c_arg_i32(i32 noundef %_a)
|
||||
// i686: void @c_arg_i32(i32 noundef %_a)
|
||||
// aarch64-apple: void @c_arg_i32(i32 noundef %_a)
|
||||
// aarch64-windows: void @c_arg_i32(i32 noundef %_a)
|
||||
// aarch64-linux: void @c_arg_i32(i32 noundef %_a)
|
||||
// arm: void @c_arg_i32(i32 noundef %_a)
|
||||
// riscv: void @c_arg_i32(i32 noundef signext %_a)
|
||||
// x86_64: void @c_arg_i32(i32 %_a)
|
||||
// i686: void @c_arg_i32(i32 %_a)
|
||||
// aarch64-apple: void @c_arg_i32(i32 %_a)
|
||||
// aarch64-windows: void @c_arg_i32(i32 %_a)
|
||||
// aarch64-linux: void @c_arg_i32(i32 %_a)
|
||||
// arm: void @c_arg_i32(i32 %_a)
|
||||
// riscv: void @c_arg_i32(i32 signext %_a)
|
||||
#[no_mangle] pub extern "C" fn c_arg_i32(_a: i32) { }
|
||||
|
||||
// x86_64: void @c_arg_i64(i64 noundef %_a)
|
||||
// i686: void @c_arg_i64(i64 noundef %_a)
|
||||
// aarch64-apple: void @c_arg_i64(i64 noundef %_a)
|
||||
// aarch64-windows: void @c_arg_i64(i64 noundef %_a)
|
||||
// aarch64-linux: void @c_arg_i64(i64 noundef %_a)
|
||||
// arm: void @c_arg_i64(i64 noundef %_a)
|
||||
// riscv: void @c_arg_i64(i64 noundef %_a)
|
||||
// x86_64: void @c_arg_i64(i64 %_a)
|
||||
// i686: void @c_arg_i64(i64 %_a)
|
||||
// aarch64-apple: void @c_arg_i64(i64 %_a)
|
||||
// aarch64-windows: void @c_arg_i64(i64 %_a)
|
||||
// aarch64-linux: void @c_arg_i64(i64 %_a)
|
||||
// arm: void @c_arg_i64(i64 %_a)
|
||||
// riscv: void @c_arg_i64(i64 %_a)
|
||||
#[no_mangle] pub extern "C" fn c_arg_i64(_a: i64) { }
|
||||
|
||||
// x86_64: zeroext i8 @c_ret_u8()
|
||||
// i686: zeroext i8 @c_ret_u8()
|
||||
// aarch64-apple: zeroext i8 @c_ret_u8()
|
||||
// aarch64-windows: i8 @c_ret_u8()
|
||||
// aarch64-linux: i8 @c_ret_u8()
|
||||
// aarch64-windows: i8 @c_ret_u8()
|
||||
// aarch64-linux: i8 @c_ret_u8()
|
||||
// arm: zeroext i8 @c_ret_u8()
|
||||
// riscv: zeroext i8 @c_ret_u8()
|
||||
#[no_mangle] pub extern "C" fn c_ret_u8() -> u8 { 0 }
|
||||
@ -117,8 +117,8 @@
|
||||
// x86_64: zeroext i16 @c_ret_u16()
|
||||
// i686: zeroext i16 @c_ret_u16()
|
||||
// aarch64-apple: zeroext i16 @c_ret_u16()
|
||||
// aarch64-windows: i16 @c_ret_u16()
|
||||
// aarch64-linux: i16 @c_ret_u16()
|
||||
// aarch64-windows: i16 @c_ret_u16()
|
||||
// aarch64-linux: i16 @c_ret_u16()
|
||||
// arm: zeroext i16 @c_ret_u16()
|
||||
// riscv: zeroext i16 @c_ret_u16()
|
||||
#[no_mangle] pub extern "C" fn c_ret_u16() -> u16 { 0 }
|
||||
@ -126,8 +126,8 @@
|
||||
// x86_64: i32 @c_ret_u32()
|
||||
// i686: i32 @c_ret_u32()
|
||||
// aarch64-apple: i32 @c_ret_u32()
|
||||
// aarch64-windows: i32 @c_ret_u32()
|
||||
// aarch64-linux: i32 @c_ret_u32()
|
||||
// aarch64-windows: i32 @c_ret_u32()
|
||||
// aarch64-linux: i32 @c_ret_u32()
|
||||
// arm: i32 @c_ret_u32()
|
||||
// riscv: signext i32 @c_ret_u32()
|
||||
#[no_mangle] pub extern "C" fn c_ret_u32() -> u32 { 0 }
|
||||
@ -135,8 +135,8 @@
|
||||
// x86_64: i64 @c_ret_u64()
|
||||
// i686: i64 @c_ret_u64()
|
||||
// aarch64-apple: i64 @c_ret_u64()
|
||||
// aarch64-windows: i64 @c_ret_u64()
|
||||
// aarch64-linux: i64 @c_ret_u64()
|
||||
// aarch64-windows: i64 @c_ret_u64()
|
||||
// aarch64-linux: i64 @c_ret_u64()
|
||||
// arm: i64 @c_ret_u64()
|
||||
// riscv: i64 @c_ret_u64()
|
||||
#[no_mangle] pub extern "C" fn c_ret_u64() -> u64 { 0 }
|
||||
@ -144,8 +144,8 @@
|
||||
// x86_64: signext i8 @c_ret_i8()
|
||||
// i686: signext i8 @c_ret_i8()
|
||||
// aarch64-apple: signext i8 @c_ret_i8()
|
||||
// aarch64-windows: i8 @c_ret_i8()
|
||||
// aarch64-linux: i8 @c_ret_i8()
|
||||
// aarch64-windows: i8 @c_ret_i8()
|
||||
// aarch64-linux: i8 @c_ret_i8()
|
||||
// arm: signext i8 @c_ret_i8()
|
||||
// riscv: signext i8 @c_ret_i8()
|
||||
#[no_mangle] pub extern "C" fn c_ret_i8() -> i8 { 0 }
|
||||
@ -153,8 +153,8 @@
|
||||
// x86_64: signext i16 @c_ret_i16()
|
||||
// i686: signext i16 @c_ret_i16()
|
||||
// aarch64-apple: signext i16 @c_ret_i16()
|
||||
// aarch64-windows: i16 @c_ret_i16()
|
||||
// aarch64-linux: i16 @c_ret_i16()
|
||||
// aarch64-windows: i16 @c_ret_i16()
|
||||
// aarch64-linux: i16 @c_ret_i16()
|
||||
// arm: signext i16 @c_ret_i16()
|
||||
// riscv: signext i16 @c_ret_i16()
|
||||
#[no_mangle] pub extern "C" fn c_ret_i16() -> i16 { 0 }
|
||||
@ -162,8 +162,8 @@
|
||||
// x86_64: i32 @c_ret_i32()
|
||||
// i686: i32 @c_ret_i32()
|
||||
// aarch64-apple: i32 @c_ret_i32()
|
||||
// aarch64-windows: i32 @c_ret_i32()
|
||||
// aarch64-linux: i32 @c_ret_i32()
|
||||
// aarch64-windows: i32 @c_ret_i32()
|
||||
// aarch64-linux: i32 @c_ret_i32()
|
||||
// arm: i32 @c_ret_i32()
|
||||
// riscv: signext i32 @c_ret_i32()
|
||||
#[no_mangle] pub extern "C" fn c_ret_i32() -> i32 { 0 }
|
||||
@ -171,8 +171,8 @@
|
||||
// x86_64: i64 @c_ret_i64()
|
||||
// i686: i64 @c_ret_i64()
|
||||
// aarch64-apple: i64 @c_ret_i64()
|
||||
// aarch64-windows: i64 @c_ret_i64()
|
||||
// aarch64-linux: i64 @c_ret_i64()
|
||||
// aarch64-windows: i64 @c_ret_i64()
|
||||
// aarch64-linux: i64 @c_ret_i64()
|
||||
// arm: i64 @c_ret_i64()
|
||||
// riscv: i64 @c_ret_i64()
|
||||
#[no_mangle] pub extern "C" fn c_ret_i64() -> i64 { 0 }
|
||||
|
@ -15,8 +15,8 @@ extern crate extern_decl;
|
||||
// it to be marked `dso_local` as well, given the static relocation model.
|
||||
//
|
||||
// CHECK: @extern_static = external dso_local local_unnamed_addr global i8
|
||||
// CHECK: define dso_local i8 @access_extern() {{.*}}
|
||||
// CHECK: declare dso_local i8 @extern_fn() {{.*}}
|
||||
// CHECK: define dso_local noundef i8 @access_extern() {{.*}}
|
||||
// CHECK: declare dso_local noundef i8 @extern_fn() {{.*}}
|
||||
|
||||
#[no_mangle]
|
||||
pub fn access_extern() -> u8 {
|
||||
|
@ -1,36 +1,36 @@
|
||||
// ignore-emscripten
|
||||
// compile-flags: -C no-prepopulate-passes
|
||||
// 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)
|
||||
|
||||
#![crate_type="lib"]
|
||||
|
||||
type ScalarZstLast = (u128, ());
|
||||
// CHECK: define noundef i128 @test_ScalarZstLast(i128 noundef %_1)
|
||||
// CHECK: define i128 @test_ScalarZstLast(i128 %_1)
|
||||
#[no_mangle]
|
||||
pub fn test_ScalarZstLast(_: ScalarZstLast) -> ScalarZstLast { loop {} }
|
||||
|
||||
type ScalarZstFirst = ((), u128);
|
||||
// CHECK: define noundef i128 @test_ScalarZstFirst(i128 noundef %_1)
|
||||
// CHECK: define i128 @test_ScalarZstFirst(i128 %_1)
|
||||
#[no_mangle]
|
||||
pub fn test_ScalarZstFirst(_: ScalarZstFirst) -> ScalarZstFirst { loop {} }
|
||||
|
||||
type ScalarPairZstLast = (u8, u128, ());
|
||||
// CHECK: define { i128, i8 } @test_ScalarPairZstLast(i128 noundef %_1.0, i8 noundef %_1.1)
|
||||
// CHECK: define { i128, i8 } @test_ScalarPairZstLast(i128 %_1.0, i8 %_1.1)
|
||||
#[no_mangle]
|
||||
pub fn test_ScalarPairZstLast(_: ScalarPairZstLast) -> ScalarPairZstLast { loop {} }
|
||||
|
||||
type ScalarPairZstFirst = ((), u8, u128);
|
||||
// CHECK: define { i8, i128 } @test_ScalarPairZstFirst(i8 noundef %_1.0, i128 noundef %_1.1)
|
||||
// CHECK: define { i8, i128 } @test_ScalarPairZstFirst(i8 %_1.0, i128 %_1.1)
|
||||
#[no_mangle]
|
||||
pub fn test_ScalarPairZstFirst(_: ScalarPairZstFirst) -> ScalarPairZstFirst { loop {} }
|
||||
|
||||
type ScalarPairLotsOfZsts = ((), u8, (), u128, ());
|
||||
// CHECK: define { i128, i8 } @test_ScalarPairLotsOfZsts(i128 noundef %_1.0, i8 noundef %_1.1)
|
||||
// CHECK: define { i128, i8 } @test_ScalarPairLotsOfZsts(i128 %_1.0, i8 %_1.1)
|
||||
#[no_mangle]
|
||||
pub fn test_ScalarPairLotsOfZsts(_: ScalarPairLotsOfZsts) -> ScalarPairLotsOfZsts { loop {} }
|
||||
|
||||
type ScalarPairLottaNesting = (((), ((), u8, (), u128, ())), ());
|
||||
// CHECK: define { i128, i8 } @test_ScalarPairLottaNesting(i128 noundef %_1.0, i8 noundef %_1.1)
|
||||
// CHECK: define { i128, i8 } @test_ScalarPairLottaNesting(i128 %_1.0, i8 %_1.1)
|
||||
#[no_mangle]
|
||||
pub fn test_ScalarPairLottaNesting(_: ScalarPairLottaNesting) -> ScalarPairLottaNesting { loop {} }
|
||||
|
@ -162,6 +162,6 @@ pub fn vec_option_bool(n: usize) -> Vec<Option<bool>> {
|
||||
}
|
||||
|
||||
// Ensure that __rust_alloc_zeroed gets the right attributes for LLVM to optimize it away.
|
||||
// CHECK: declare noalias ptr @__rust_alloc_zeroed(i64, i64 allocalign) unnamed_addr [[RUST_ALLOC_ZEROED_ATTRS:#[0-9]+]]
|
||||
// CHECK: declare noalias noundef ptr @__rust_alloc_zeroed(i64 noundef, i64 allocalign noundef) unnamed_addr [[RUST_ALLOC_ZEROED_ATTRS:#[0-9]+]]
|
||||
|
||||
// CHECK-DAG: attributes [[RUST_ALLOC_ZEROED_ATTRS]] = { {{.*}} allockind("alloc,zeroed,aligned") allocsize(0) uwtable "alloc-family"="__rust_alloc" {{.*}} }
|
||||
|
@ -1,10 +1,10 @@
|
||||
// compile-flags: -C no-prepopulate-passes
|
||||
// compile-flags: -C no-prepopulate-passes -Copt-level=0
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#![feature(repr_simd)]
|
||||
|
||||
// Hack to get the correct size for the length part in slices
|
||||
// CHECK: @helper([[USIZE:i[0-9]+]] noundef %_1)
|
||||
// CHECK: @helper([[USIZE:i[0-9]+]] %_1)
|
||||
#[no_mangle]
|
||||
pub fn helper(_: usize) {
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user