Run rustfmt on tests/codegen/
.
Except for `simd-intrinsic/`, which has a lot of files containing multiple types like `u8x64` which really are better when hand-formatted. There is a surprising amount of two-space indenting in this directory. Non-trivial changes: - `rustfmt::skip` needed in `debug-column.rs` to preserve meaning of the test. - `rustfmt::skip` used in a few places where hand-formatting read more nicely: `enum/enum-match.rs` - Line number adjustments needed for the expected output of `debug-column.rs` and `coroutine-debug.rs`.
This commit is contained in:
parent
b1b18e6031
commit
72800d3b89
211 changed files with 1445 additions and 1332 deletions
|
@ -14,7 +14,7 @@ ignore = [
|
||||||
# - some contain syntax errors that cause rustfmt to give an error
|
# - some contain syntax errors that cause rustfmt to give an error
|
||||||
# - some UI tests are broken by different formatting
|
# - some UI tests are broken by different formatting
|
||||||
# - some require special comments in a particular position (e.g. `EMIT_MIR` comments)
|
# - some require special comments in a particular position (e.g. `EMIT_MIR` comments)
|
||||||
"/tests/codegen/",
|
"/tests/codegen/simd-intrinsic/", # Many types like `u8x64` are better hand-formatted.
|
||||||
"/tests/codegen-units/",
|
"/tests/codegen-units/",
|
||||||
"/tests/coverage/",
|
"/tests/coverage/",
|
||||||
"/tests/coverage-run-rustdoc/",
|
"/tests/coverage-run-rustdoc/",
|
||||||
|
|
|
@ -19,8 +19,6 @@ trait Freeze { }
|
||||||
#[lang = "copy"]
|
#[lang = "copy"]
|
||||||
trait Copy {}
|
trait Copy {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Passed as `[i64 x 2]`, since it's an aggregate with size <= 128 bits, align < 128 bits.
|
// Passed as `[i64 x 2]`, since it's an aggregate with size <= 128 bits, align < 128 bits.
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct Align8 {
|
pub struct Align8 {
|
||||||
|
@ -31,7 +29,7 @@ pub struct Align8 {
|
||||||
// repr(transparent), so same as above.
|
// repr(transparent), so same as above.
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct Transparent8 {
|
pub struct Transparent8 {
|
||||||
a: Align8
|
a: Align8,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Passed as `[i64 x 2]`, since it's an aggregate with size <= 128 bits, align < 128 bits.
|
// Passed as `[i64 x 2]`, since it's an aggregate with size <= 128 bits, align < 128 bits.
|
||||||
|
@ -47,8 +45,6 @@ extern "C" {
|
||||||
fn test_8(a: Align8, b: Transparent8, c: Wrapped8);
|
fn test_8(a: Align8, b: Transparent8, c: Wrapped8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Passed as `i128`, since it's an aggregate with size <= 128 bits, align = 128 bits.
|
// Passed as `i128`, since it's an aggregate with size <= 128 bits, align = 128 bits.
|
||||||
// EXCEPT on Linux, where there's a special case to use its unadjusted alignment,
|
// EXCEPT on Linux, where there's a special case to use its unadjusted alignment,
|
||||||
// making it the same as `Align8`, so it's be passed as `[i64 x 2]`.
|
// making it the same as `Align8`, so it's be passed as `[i64 x 2]`.
|
||||||
|
@ -62,7 +58,7 @@ pub struct Align16 {
|
||||||
// repr(transparent), so same as above.
|
// repr(transparent), so same as above.
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct Transparent16 {
|
pub struct Transparent16 {
|
||||||
a: Align16
|
a: Align16,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Passed as `i128`, since it's an aggregate with size <= 128 bits, align = 128 bits.
|
// Passed as `i128`, since it's an aggregate with size <= 128 bits, align = 128 bits.
|
||||||
|
@ -79,8 +75,6 @@ extern "C" {
|
||||||
fn test_16(a: Align16, b: Transparent16, c: Wrapped16);
|
fn test_16(a: Align16, b: Transparent16, c: Wrapped16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Passed as `i128`, since it's an aggregate with size <= 128 bits, align = 128 bits.
|
// Passed as `i128`, since it's an aggregate with size <= 128 bits, align = 128 bits.
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct I128 {
|
pub struct I128 {
|
||||||
|
@ -90,13 +84,13 @@ pub struct I128 {
|
||||||
// repr(transparent), so same as above.
|
// repr(transparent), so same as above.
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct TransparentI128 {
|
pub struct TransparentI128 {
|
||||||
a: I128
|
a: I128,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Passed as `i128`, since it's an aggregate with size <= 128 bits, align = 128 bits.
|
// Passed as `i128`, since it's an aggregate with size <= 128 bits, align = 128 bits.
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct WrappedI128 {
|
pub struct WrappedI128 {
|
||||||
pub a: I128
|
pub a: I128,
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -106,8 +100,6 @@ extern "C" {
|
||||||
fn test_i128(a: I128, b: TransparentI128, c: WrappedI128);
|
fn test_i128(a: I128, b: TransparentI128, c: WrappedI128);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Passed as `[2 x i64]`, since it's an aggregate with size <= 128 bits, align < 128 bits.
|
// Passed as `[2 x i64]`, since it's an aggregate with size <= 128 bits, align < 128 bits.
|
||||||
// Note that the Linux special case does not apply, because packing is not considered "adjustment".
|
// Note that the Linux special case does not apply, because packing is not considered "adjustment".
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
@ -119,13 +111,13 @@ pub struct Packed {
|
||||||
// repr(transparent), so same as above.
|
// repr(transparent), so same as above.
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct TransparentPacked {
|
pub struct TransparentPacked {
|
||||||
a: Packed
|
a: Packed,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Passed as `[2 x i64]`, since it's an aggregate with size <= 128 bits, align < 128 bits.
|
// Passed as `[2 x i64]`, since it's an aggregate with size <= 128 bits, align < 128 bits.
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct WrappedPacked {
|
pub struct WrappedPacked {
|
||||||
pub a: Packed
|
pub a: Packed,
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -135,13 +127,19 @@ extern "C" {
|
||||||
fn test_packed(a: Packed, b: TransparentPacked, c: WrappedPacked);
|
fn test_packed(a: Packed, b: TransparentPacked, c: WrappedPacked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pub unsafe fn main(
|
pub unsafe fn main(
|
||||||
a1: Align8, a2: Transparent8, a3: Wrapped8,
|
a1: Align8,
|
||||||
b1: Align16, b2: Transparent16, b3: Wrapped16,
|
a2: Transparent8,
|
||||||
c1: I128, c2: TransparentI128, c3: WrappedI128,
|
a3: Wrapped8,
|
||||||
d1: Packed, d2: TransparentPacked, d3: WrappedPacked,
|
b1: Align16,
|
||||||
|
b2: Transparent16,
|
||||||
|
b3: Wrapped16,
|
||||||
|
c1: I128,
|
||||||
|
c2: TransparentI128,
|
||||||
|
c3: WrappedI128,
|
||||||
|
d1: Packed,
|
||||||
|
d2: TransparentPacked,
|
||||||
|
d3: WrappedPacked,
|
||||||
) {
|
) {
|
||||||
test_8(a1, a2, a3);
|
test_8(a1, a2, a3);
|
||||||
test_16(b1, b2, b3);
|
test_16(b1, b2, b3);
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
//@[avr] only-avr
|
//@[avr] only-avr
|
||||||
//@[msp] only-msp430
|
//@[msp] only-msp430
|
||||||
|
|
||||||
|
fn main() {}
|
||||||
fn main() {
|
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: define i16 @main(i16, i8**)
|
// CHECK: define i16 @main(i16, i8**)
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
//@ ignore-avr
|
//@ ignore-avr
|
||||||
//@ ignore-wasi wasi codegens the main symbol differently
|
//@ ignore-wasi wasi codegens the main symbol differently
|
||||||
|
|
||||||
fn main() {
|
fn main() {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: define{{( hidden| noundef)*}} i32 @main(i32{{( %0)?}}, ptr{{( %1)?}})
|
// CHECK: define{{( hidden| noundef)*}} i32 @main(i32{{( %0)?}}, ptr{{( %1)?}})
|
||||||
|
|
|
@ -24,14 +24,17 @@
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_core]
|
#![no_core]
|
||||||
|
|
||||||
#[lang="sized"] trait Sized { }
|
#[lang = "sized"]
|
||||||
#[lang="freeze"] trait Freeze { }
|
trait Sized {}
|
||||||
#[lang="copy"] trait Copy { }
|
#[lang = "freeze"]
|
||||||
|
trait Freeze {}
|
||||||
|
#[lang = "copy"]
|
||||||
|
trait Copy {}
|
||||||
|
|
||||||
#[repr(i8)]
|
#[repr(i8)]
|
||||||
pub enum Type {
|
pub enum Type {
|
||||||
Type1 = 0,
|
Type1 = 0,
|
||||||
Type2 = 1
|
Type2 = 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
// To accommodate rust#97800, one might consider writing the below as:
|
// To accommodate rust#97800, one might consider writing the below as:
|
||||||
|
@ -50,7 +53,6 @@ pub enum Type {
|
||||||
// riscv-SAME: signext
|
// riscv-SAME: signext
|
||||||
// CHECK-SAME: i8 @test()
|
// CHECK-SAME: i8 @test()
|
||||||
|
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test() -> Type {
|
pub extern "C" fn test() -> Type {
|
||||||
Type::Type1
|
Type::Type1
|
||||||
|
|
|
@ -5,8 +5,7 @@
|
||||||
// Hack to get the correct size for the length part in slices
|
// Hack to get the correct size for the length part in slices
|
||||||
// CHECK: @helper([[USIZE:i[0-9]+]] %_1)
|
// CHECK: @helper([[USIZE:i[0-9]+]] %_1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn helper(_: usize) {
|
pub fn helper(_: usize) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK-LABEL: @no_op_slice_adjustment
|
// CHECK-LABEL: @no_op_slice_adjustment
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
|
|
@ -23,9 +23,12 @@
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_core]
|
#![no_core]
|
||||||
|
|
||||||
#[lang="sized"] trait Sized { }
|
#[lang = "sized"]
|
||||||
#[lang="freeze"] trait Freeze { }
|
trait Sized {}
|
||||||
#[lang="copy"] trait Copy { }
|
#[lang = "freeze"]
|
||||||
|
trait Freeze {}
|
||||||
|
#[lang = "copy"]
|
||||||
|
trait Copy {}
|
||||||
|
|
||||||
impl Copy for i32 {}
|
impl Copy for i32 {}
|
||||||
impl Copy for i64 {}
|
impl Copy for i64 {}
|
||||||
|
@ -58,7 +61,7 @@ pub struct ForceAlign4 {
|
||||||
pub struct NaturalAlign8 {
|
pub struct NaturalAlign8 {
|
||||||
a: i64,
|
a: i64,
|
||||||
b: i64,
|
b: i64,
|
||||||
c: i64
|
c: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
// On i686-windows, this is passed by reference (because alignment is >4 and requested/forced),
|
// On i686-windows, this is passed by reference (because alignment is >4 and requested/forced),
|
||||||
|
@ -68,7 +71,7 @@ pub struct NaturalAlign8 {
|
||||||
pub struct ForceAlign8 {
|
pub struct ForceAlign8 {
|
||||||
a: i64,
|
a: i64,
|
||||||
b: i64,
|
b: i64,
|
||||||
c: i64
|
c: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
// On i686-windows, this is passed on stack, because requested alignment is <=4.
|
// On i686-windows, this is passed on stack, because requested alignment is <=4.
|
||||||
|
@ -77,28 +80,28 @@ pub struct ForceAlign8 {
|
||||||
pub struct LowerFA8 {
|
pub struct LowerFA8 {
|
||||||
a: i64,
|
a: i64,
|
||||||
b: i64,
|
b: i64,
|
||||||
c: i64
|
c: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
// On i686-windows, this is passed by reference, because it contains a field with
|
// On i686-windows, this is passed by reference, because it contains a field with
|
||||||
// requested/forced alignment.
|
// requested/forced alignment.
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct WrappedFA8 {
|
pub struct WrappedFA8 {
|
||||||
a: ForceAlign8
|
a: ForceAlign8,
|
||||||
}
|
}
|
||||||
|
|
||||||
// On i686-windows, this has the same ABI as ForceAlign8, i.e. passed by reference.
|
// On i686-windows, this has the same ABI as ForceAlign8, i.e. passed by reference.
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct TransparentFA8 {
|
pub struct TransparentFA8 {
|
||||||
_0: (),
|
_0: (),
|
||||||
a: ForceAlign8
|
a: ForceAlign8,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[repr(align(16))]
|
#[repr(align(16))]
|
||||||
pub struct ForceAlign16 {
|
pub struct ForceAlign16 {
|
||||||
a: [i32; 16],
|
a: [i32; 16],
|
||||||
b: i8
|
b: i8,
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK-LABEL: @call_na1
|
// CHECK-LABEL: @call_na1
|
||||||
|
|
|
@ -53,7 +53,6 @@ pub fn align_offset_word_slice(slice: &[Align4]) -> usize {
|
||||||
slice.as_ptr().align_offset(32)
|
slice.as_ptr().align_offset(32)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// CHECK-LABEL: @align_offset_word_ptr(ptr{{.+}}%ptr
|
// CHECK-LABEL: @align_offset_word_ptr(ptr{{.+}}%ptr
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn align_offset_word_ptr(ptr: *const Align4) -> usize {
|
pub fn align_offset_word_ptr(ptr: *const Align4) -> usize {
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn compare() -> bool {
|
pub fn compare() -> bool {
|
||||||
let bytes = 12.5f32.to_ne_bytes();
|
let bytes = 12.5f32.to_ne_bytes();
|
||||||
bytes == if cfg!(target_endian = "big") {
|
bytes
|
||||||
|
== if cfg!(target_endian = "big") {
|
||||||
[0x41, 0x48, 0x00, 0x00]
|
[0x41, 0x48, 0x00, 0x00]
|
||||||
} else {
|
} else {
|
||||||
[0x00, 0x00, 0x48, 0x41]
|
[0x00, 0x00, 0x48, 0x41]
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
#![crate_type = "rlib"]
|
#![crate_type = "rlib"]
|
||||||
#![allow(asm_sub_register)]
|
#![allow(asm_sub_register)]
|
||||||
|
|
||||||
use std::mem::MaybeUninit;
|
|
||||||
use std::arch::asm;
|
use std::arch::asm;
|
||||||
|
use std::mem::MaybeUninit;
|
||||||
|
|
||||||
// CHECK-LABEL: @int
|
// CHECK-LABEL: @int
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
|
|
@ -21,14 +21,10 @@ trait Copy {}
|
||||||
|
|
||||||
pub unsafe fn we_escape_dollar_signs() {
|
pub unsafe fn we_escape_dollar_signs() {
|
||||||
// CHECK: call void asm sideeffect alignstack inteldialect "banana$$:"
|
// CHECK: call void asm sideeffect alignstack inteldialect "banana$$:"
|
||||||
asm!(
|
asm!(r"banana$:",)
|
||||||
r"banana$:",
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn we_escape_escapes_too() {
|
pub unsafe fn we_escape_escapes_too() {
|
||||||
// CHECK: call void asm sideeffect alignstack inteldialect "banana\{{(\\|5C)}}36:"
|
// CHECK: call void asm sideeffect alignstack inteldialect "banana\{{(\\|5C)}}36:"
|
||||||
asm!(
|
asm!(r"banana\36:",)
|
||||||
r"banana\36:",
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,13 +6,12 @@
|
||||||
|
|
||||||
//@ compile-flags: -O -Cno-prepopulate-passes
|
//@ compile-flags: -O -Cno-prepopulate-passes
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
#![feature(strict_provenance)]
|
#![feature(strict_provenance)]
|
||||||
#![feature(strict_provenance_atomic_ptr)]
|
#![feature(strict_provenance_atomic_ptr)]
|
||||||
|
|
||||||
|
use std::ptr::without_provenance_mut;
|
||||||
use std::sync::atomic::AtomicPtr;
|
use std::sync::atomic::AtomicPtr;
|
||||||
use std::sync::atomic::Ordering::Relaxed;
|
use std::sync::atomic::Ordering::Relaxed;
|
||||||
use std::ptr::without_provenance_mut;
|
|
||||||
|
|
||||||
// Portability hack so that we can say [[USIZE]] instead of i64/i32/i16 for usize.
|
// Portability hack so that we can say [[USIZE]] instead of i64/i32/i16 for usize.
|
||||||
// CHECK: @helper([[USIZE:i[0-9]+]] noundef %_1)
|
// CHECK: @helper([[USIZE:i[0-9]+]] noundef %_1)
|
||||||
|
|
|
@ -9,12 +9,7 @@ pub fn auto_vectorize_direct(a: [f32; 4], b: [f32; 4]) -> [f32; 4] {
|
||||||
// CHECK: load <4 x float>
|
// CHECK: load <4 x float>
|
||||||
// CHECK: fadd <4 x float>
|
// CHECK: fadd <4 x float>
|
||||||
// CHECK: store <4 x float>
|
// CHECK: store <4 x float>
|
||||||
[
|
[a[0] + b[0], a[1] + b[1], a[2] + b[2], a[3] + b[3]]
|
||||||
a[0] + b[0],
|
|
||||||
a[1] + b[1],
|
|
||||||
a[2] + b[2],
|
|
||||||
a[3] + b[3],
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK-LABEL: @auto_vectorize_loop
|
// CHECK-LABEL: @auto_vectorize_loop
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn extern_fn() -> u8 { unsafe { extern_static } }
|
pub fn extern_fn() -> u8 {
|
||||||
|
unsafe { extern_static }
|
||||||
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub static mut extern_static: u8 = 71;
|
pub static mut extern_static: u8 = 71;
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn bar() {
|
pub fn bar() {}
|
||||||
}
|
|
||||||
|
|
|
@ -22,7 +22,10 @@ pub trait Receiver { }
|
||||||
#[lang = "tuple_trait"]
|
#[lang = "tuple_trait"]
|
||||||
pub trait Tuple {}
|
pub trait Tuple {}
|
||||||
|
|
||||||
pub struct Result<T, E> { _a: T, _b: E }
|
pub struct Result<T, E> {
|
||||||
|
_a: T,
|
||||||
|
_b: E,
|
||||||
|
}
|
||||||
|
|
||||||
impl Copy for usize {}
|
impl Copy for usize {}
|
||||||
impl Copy for &usize {}
|
impl Copy for &usize {}
|
||||||
|
@ -110,7 +113,10 @@ pub unsafe fn transmute_fn_ptr_to_data(x: fn()) -> *const () {
|
||||||
transmute(x)
|
transmute(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum Either<T, U> { A(T), B(U) }
|
pub enum Either<T, U> {
|
||||||
|
A(T),
|
||||||
|
B(U),
|
||||||
|
}
|
||||||
|
|
||||||
// Previously, we would codegen this as passing/returning a scalar pair of `{ i8, ptr }`,
|
// Previously, we would codegen this as passing/returning a scalar pair of `{ i8, ptr }`,
|
||||||
// with the `ptr` field representing both `&i32` and `fn()` depending on the variant.
|
// with the `ptr` field representing both `&i32` and `fn()` depending on the variant.
|
||||||
|
|
|
@ -11,11 +11,7 @@ pub fn binary_search_index_no_bounds_check(s: &[u8]) -> u8 {
|
||||||
// CHECK-NOT: slice_start_index_len_fail
|
// CHECK-NOT: slice_start_index_len_fail
|
||||||
// CHECK-NOT: slice_end_index_len_fail
|
// CHECK-NOT: slice_end_index_len_fail
|
||||||
// CHECK-NOT: panic_bounds_check
|
// CHECK-NOT: panic_bounds_check
|
||||||
if let Ok(idx) = s.binary_search(&b'\\') {
|
if let Ok(idx) = s.binary_search(&b'\\') { s[idx] } else { 42 }
|
||||||
s[idx]
|
|
||||||
} else {
|
|
||||||
42
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Similarly, check that `partition_point` is known to return a valid fencepost.
|
// Similarly, check that `partition_point` is known to return a valid fencepost.
|
||||||
|
|
|
@ -16,8 +16,7 @@
|
||||||
trait Sized {}
|
trait Sized {}
|
||||||
|
|
||||||
// A basic test function.
|
// A basic test function.
|
||||||
pub fn test() {
|
pub fn test() {}
|
||||||
}
|
|
||||||
|
|
||||||
// BTI: !"branch-target-enforcement", i32 1
|
// BTI: !"branch-target-enforcement", i32 1
|
||||||
// BTI: !"sign-return-address", i32 0
|
// BTI: !"sign-return-address", i32 0
|
||||||
|
|
|
@ -18,9 +18,12 @@
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_core]
|
#![no_core]
|
||||||
|
|
||||||
#[lang="sized"] trait Sized { }
|
#[lang = "sized"]
|
||||||
#[lang="freeze"] trait Freeze { }
|
trait Sized {}
|
||||||
#[lang="copy"] trait Copy { }
|
#[lang = "freeze"]
|
||||||
|
trait Freeze {}
|
||||||
|
#[lang = "copy"]
|
||||||
|
trait Copy {}
|
||||||
|
|
||||||
// This struct will be passed as a single `i64` or `i32`.
|
// This struct will be passed as a single `i64` or `i32`.
|
||||||
// This may be (if `i64)) larger than the Rust layout, which is just `{ i16, i16 }`.
|
// This may be (if `i64)) larger than the Rust layout, which is just `{ i16, i16 }`.
|
||||||
|
@ -104,7 +107,6 @@ pub unsafe fn return_twou16s() -> TwoU16s {
|
||||||
// powerpc64: [[RETVAL:%.+]] = alloca [4 x i8], align 2
|
// powerpc64: [[RETVAL:%.+]] = alloca [4 x i8], align 2
|
||||||
// powerpc64: call void @returns_twou16s(ptr {{.+}} [[RETVAL]])
|
// powerpc64: call void @returns_twou16s(ptr {{.+}} [[RETVAL]])
|
||||||
|
|
||||||
|
|
||||||
// The other targets copy the cast ABI type to an alloca.
|
// The other targets copy the cast ABI type to an alloca.
|
||||||
|
|
||||||
// aarch64: [[ABI_ALLOCA:%.+]] = alloca [8 x i8], align [[ABI_ALIGN:8]]
|
// aarch64: [[ABI_ALLOCA:%.+]] = alloca [8 x i8], align [[ABI_ALIGN:8]]
|
||||||
|
@ -151,7 +153,6 @@ pub unsafe fn return_fiveu16s() -> FiveU16s {
|
||||||
|
|
||||||
// powerpc64: call void @returns_fiveu16s(ptr {{.+}} [[RET_PTR]])
|
// powerpc64: call void @returns_fiveu16s(ptr {{.+}} [[RET_PTR]])
|
||||||
|
|
||||||
|
|
||||||
// The other targets copy the cast ABI type to the sret pointer.
|
// The other targets copy the cast ABI type to the sret pointer.
|
||||||
|
|
||||||
// aarch64: [[ABI_ALLOCA:%.+]] = alloca [16 x i8], align [[ABI_ALIGN:8]]
|
// aarch64: [[ABI_ALLOCA:%.+]] = alloca [16 x i8], align [[ABI_ALIGN:8]]
|
||||||
|
@ -199,7 +200,6 @@ pub unsafe fn return_doubledouble() -> DoubleDouble {
|
||||||
// powerpc64: [[RETVAL:%.+]] = alloca [16 x i8], align 8
|
// powerpc64: [[RETVAL:%.+]] = alloca [16 x i8], align 8
|
||||||
// powerpc64: call void @returns_doubledouble(ptr {{.+}} [[RETVAL]])
|
// powerpc64: call void @returns_doubledouble(ptr {{.+}} [[RETVAL]])
|
||||||
|
|
||||||
|
|
||||||
// The other targets copy the cast ABI type to an alloca.
|
// The other targets copy the cast ABI type to an alloca.
|
||||||
|
|
||||||
// aarch64: [[ABI_ALLOCA:%.+]] = alloca [16 x i8], align [[ABI_ALIGN:8]]
|
// aarch64: [[ABI_ALLOCA:%.+]] = alloca [16 x i8], align [[ABI_ALIGN:8]]
|
||||||
|
@ -266,7 +266,6 @@ pub unsafe fn return_doublefloat() -> DoubleFloat {
|
||||||
// powerpc64: [[RETVAL:%.+]] = alloca [16 x i8], align 8
|
// powerpc64: [[RETVAL:%.+]] = alloca [16 x i8], align 8
|
||||||
// powerpc64: call void @returns_doublefloat(ptr {{.+}} [[RETVAL]])
|
// powerpc64: call void @returns_doublefloat(ptr {{.+}} [[RETVAL]])
|
||||||
|
|
||||||
|
|
||||||
// The other targets copy the cast ABI type to an alloca.
|
// The other targets copy the cast ABI type to an alloca.
|
||||||
|
|
||||||
// aarch64: [[ABI_ALLOCA:%.+]] = alloca [16 x i8], align [[ABI_ALIGN:8]]
|
// aarch64: [[ABI_ALLOCA:%.+]] = alloca [16 x i8], align [[ABI_ALIGN:8]]
|
||||||
|
|
|
@ -17,8 +17,7 @@
|
||||||
trait Sized {}
|
trait Sized {}
|
||||||
|
|
||||||
// A basic test function.
|
// A basic test function.
|
||||||
pub fn test() {
|
pub fn test() {}
|
||||||
}
|
|
||||||
|
|
||||||
// undefined-NOT: !"cf-protection-branch"
|
// undefined-NOT: !"cf-protection-branch"
|
||||||
// undefined-NOT: !"cf-protection-return"
|
// undefined-NOT: !"cf-protection-return"
|
||||||
|
|
|
@ -2,12 +2,15 @@
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
#![feature(ffi_const)]
|
#![feature(ffi_const)]
|
||||||
|
|
||||||
pub fn bar() { unsafe { foo() } }
|
pub fn bar() {
|
||||||
|
unsafe { foo() }
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
// CHECK-LABEL: declare{{.*}}void @foo()
|
// CHECK-LABEL: declare{{.*}}void @foo()
|
||||||
// CHECK-SAME: [[ATTRS:#[0-9]+]]
|
// CHECK-SAME: [[ATTRS:#[0-9]+]]
|
||||||
// The attribute changed from `readnone` to `memory(none)` with LLVM 16.0.
|
// The attribute changed from `readnone` to `memory(none)` with LLVM 16.0.
|
||||||
// CHECK-DAG: attributes [[ATTRS]] = { {{.*}}{{readnone|memory\(none\)}}{{.*}} }
|
// CHECK-DAG: attributes [[ATTRS]] = { {{.*}}{{readnone|memory\(none\)}}{{.*}} }
|
||||||
#[ffi_const] pub fn foo();
|
#[ffi_const]
|
||||||
|
pub fn foo();
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,9 +13,12 @@
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_core]
|
#![no_core]
|
||||||
|
|
||||||
#[lang="sized"] trait Sized { }
|
#[lang = "sized"]
|
||||||
#[lang="freeze"] trait Freeze { }
|
trait Sized {}
|
||||||
#[lang="copy"] trait Copy { }
|
#[lang = "freeze"]
|
||||||
|
trait Freeze {}
|
||||||
|
#[lang = "copy"]
|
||||||
|
trait Copy {}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
struct S {
|
struct S {
|
||||||
|
|
|
@ -2,12 +2,15 @@
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
#![feature(ffi_pure)]
|
#![feature(ffi_pure)]
|
||||||
|
|
||||||
pub fn bar() { unsafe { foo() } }
|
pub fn bar() {
|
||||||
|
unsafe { foo() }
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
// CHECK-LABEL: declare{{.*}}void @foo()
|
// CHECK-LABEL: declare{{.*}}void @foo()
|
||||||
// CHECK-SAME: [[ATTRS:#[0-9]+]]
|
// CHECK-SAME: [[ATTRS:#[0-9]+]]
|
||||||
// The attribute changed from `readonly` to `memory(read)` with LLVM 16.0.
|
// The attribute changed from `readonly` to `memory(read)` with LLVM 16.0.
|
||||||
// CHECK-DAG: attributes [[ATTRS]] = { {{.*}}{{readonly|memory\(read\)}}{{.*}} }
|
// CHECK-DAG: attributes [[ATTRS]] = { {{.*}}{{readonly|memory\(read\)}}{{.*}} }
|
||||||
#[ffi_pure] pub fn foo();
|
#[ffi_pure]
|
||||||
|
pub fn foo();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,7 @@
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
// A basic test function.
|
// A basic test function.
|
||||||
pub fn test() {
|
pub fn test() {}
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure the module flag cfguard=2 is present
|
// Ensure the module flag cfguard=2 is present
|
||||||
// CHECK: !"cfguard", i32 2
|
// CHECK: !"cfguard", i32 2
|
||||||
|
|
|
@ -4,8 +4,7 @@
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
// A basic test function.
|
// A basic test function.
|
||||||
pub fn test() {
|
pub fn test() {}
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure the module flag cfguard is not present
|
// Ensure the module flag cfguard is not present
|
||||||
// CHECK-NOT: !"cfguard"
|
// CHECK-NOT: !"cfguard"
|
||||||
|
|
|
@ -4,8 +4,7 @@
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
// A basic test function.
|
// A basic test function.
|
||||||
pub fn test() {
|
pub fn test() {}
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure the module flag cfguard=1 is present
|
// Ensure the module flag cfguard=1 is present
|
||||||
// CHECK: !"cfguard", i32 1
|
// CHECK: !"cfguard", i32 1
|
||||||
|
|
|
@ -4,8 +4,7 @@
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
// A basic test function.
|
// A basic test function.
|
||||||
pub fn test() {
|
pub fn test() {}
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure the cfguard module flag is not added for non-MSVC targets.
|
// Ensure the cfguard module flag is not added for non-MSVC targets.
|
||||||
// CHECK-NOT: !"cfguard"
|
// CHECK-NOT: !"cfguard"
|
||||||
|
|
|
@ -8,18 +8,10 @@
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn if_bool() {
|
pub fn if_bool() {
|
||||||
// CHECK: br label %{{.+}}
|
// CHECK: br label %{{.+}}
|
||||||
_ = if true {
|
_ = if true { 0 } else { 1 };
|
||||||
0
|
|
||||||
} else {
|
|
||||||
1
|
|
||||||
};
|
|
||||||
|
|
||||||
// CHECK: br label %{{.+}}
|
// CHECK: br label %{{.+}}
|
||||||
_ = if false {
|
_ = if false { 0 } else { 1 };
|
||||||
0
|
|
||||||
} else {
|
|
||||||
1
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK-LABEL: @if_constant_int_eq
|
// CHECK-LABEL: @if_constant_int_eq
|
||||||
|
@ -27,18 +19,10 @@ pub fn if_bool() {
|
||||||
pub fn if_constant_int_eq() {
|
pub fn if_constant_int_eq() {
|
||||||
let val = 0;
|
let val = 0;
|
||||||
// CHECK: br label %{{.+}}
|
// CHECK: br label %{{.+}}
|
||||||
_ = if val == 0 {
|
_ = if val == 0 { 0 } else { 1 };
|
||||||
0
|
|
||||||
} else {
|
|
||||||
1
|
|
||||||
};
|
|
||||||
|
|
||||||
// CHECK: br label %{{.+}}
|
// CHECK: br label %{{.+}}
|
||||||
_ = if val == 1 {
|
_ = if val == 1 { 0 } else { 1 };
|
||||||
0
|
|
||||||
} else {
|
|
||||||
1
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK-LABEL: @if_constant_match
|
// CHECK-LABEL: @if_constant_match
|
||||||
|
@ -48,13 +32,13 @@ pub fn if_constant_match() {
|
||||||
_ = match 1 {
|
_ = match 1 {
|
||||||
1 => 2,
|
1 => 2,
|
||||||
2 => 3,
|
2 => 3,
|
||||||
_ => 4
|
_ => 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
// CHECK: br label %{{.+}}
|
// CHECK: br label %{{.+}}
|
||||||
_ = match 1 {
|
_ = match 1 {
|
||||||
2 => 3,
|
2 => 3,
|
||||||
_ => 4
|
_ => 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
// CHECK: br label %[[MINUS1:.+]]
|
// CHECK: br label %[[MINUS1:.+]]
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
use std::ops::Coroutine;
|
use std::ops::Coroutine;
|
||||||
|
|
||||||
fn coroutine_test() -> impl Coroutine<Yield = i32, Return = ()> {
|
fn coroutine_test() -> impl Coroutine<Yield = i32, Return = ()> {
|
||||||
#[coroutine] || {
|
#[coroutine]
|
||||||
|
|| {
|
||||||
yield 0;
|
yield 0;
|
||||||
let s = String::from("foo");
|
let s = String::from("foo");
|
||||||
yield 1;
|
yield 1;
|
||||||
|
@ -23,23 +24,23 @@ fn coroutine_test() -> impl Coroutine<Yield = i32, Return = ()> {
|
||||||
// CHECK-DAG: [[GEN:!.*]] = !DICompositeType(tag: DW_TAG_union_type, name: "enum2$<coroutine_debug_msvc::coroutine_test::coroutine_env$0>"
|
// CHECK-DAG: [[GEN:!.*]] = !DICompositeType(tag: DW_TAG_union_type, name: "enum2$<coroutine_debug_msvc::coroutine_test::coroutine_env$0>"
|
||||||
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant0", scope: [[GEN]],
|
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant0", scope: [[GEN]],
|
||||||
// For brevity, we only check the struct name and members of the last variant.
|
// For brevity, we only check the struct name and members of the last variant.
|
||||||
// CHECK-SAME: file: [[FILE:![0-9]*]], line: 14,
|
// CHECK-SAME: file: [[FILE:![0-9]*]], line: 15,
|
||||||
// CHECK-NOT: flags: DIFlagArtificial
|
// CHECK-NOT: flags: DIFlagArtificial
|
||||||
// CHECK-SAME: )
|
// CHECK-SAME: )
|
||||||
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant1", scope: [[GEN]],
|
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant1", scope: [[GEN]],
|
||||||
// CHECK-SAME: file: [[FILE]], line: 18,
|
// CHECK-SAME: file: [[FILE]], line: 19,
|
||||||
// CHECK-NOT: flags: DIFlagArtificial
|
// CHECK-NOT: flags: DIFlagArtificial
|
||||||
// CHECK-SAME: )
|
// CHECK-SAME: )
|
||||||
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant2", scope: [[GEN]],
|
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant2", scope: [[GEN]],
|
||||||
// CHECK-SAME: file: [[FILE]], line: 18,
|
// CHECK-SAME: file: [[FILE]], line: 19,
|
||||||
// CHECK-NOT: flags: DIFlagArtificial
|
// CHECK-NOT: flags: DIFlagArtificial
|
||||||
// CHECK-SAME: )
|
// CHECK-SAME: )
|
||||||
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant3", scope: [[GEN]],
|
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant3", scope: [[GEN]],
|
||||||
// CHECK-SAME: file: [[FILE]], line: 15,
|
// CHECK-SAME: file: [[FILE]], line: 16,
|
||||||
// CHECK-NOT: flags: DIFlagArtificial
|
// CHECK-NOT: flags: DIFlagArtificial
|
||||||
// CHECK-SAME: )
|
// CHECK-SAME: )
|
||||||
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant4", scope: [[GEN]],
|
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant4", scope: [[GEN]],
|
||||||
// CHECK-SAME: file: [[FILE]], line: 17,
|
// CHECK-SAME: file: [[FILE]], line: 18,
|
||||||
// CHECK-SAME: baseType: [[VARIANT_WRAPPER:![0-9]*]]
|
// CHECK-SAME: baseType: [[VARIANT_WRAPPER:![0-9]*]]
|
||||||
// CHECK-NOT: flags: DIFlagArtificial
|
// CHECK-NOT: flags: DIFlagArtificial
|
||||||
// CHECK-SAME: )
|
// CHECK-SAME: )
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
use std::ops::Coroutine;
|
use std::ops::Coroutine;
|
||||||
|
|
||||||
fn coroutine_test() -> impl Coroutine<Yield = i32, Return = ()> {
|
fn coroutine_test() -> impl Coroutine<Yield = i32, Return = ()> {
|
||||||
#[coroutine] || {
|
#[coroutine]
|
||||||
|
|| {
|
||||||
yield 0;
|
yield 0;
|
||||||
let s = String::from("foo");
|
let s = String::from("foo");
|
||||||
yield 1;
|
yield 1;
|
||||||
|
@ -26,26 +27,26 @@ fn coroutine_test() -> impl Coroutine<Yield = i32, Return = ()> {
|
||||||
// CHECK-NOT: flags: DIFlagArtificial
|
// CHECK-NOT: flags: DIFlagArtificial
|
||||||
// CHECK-SAME: discriminator: [[DISC:![0-9]*]]
|
// CHECK-SAME: discriminator: [[DISC:![0-9]*]]
|
||||||
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "0", scope: [[VARIANT]],
|
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "0", scope: [[VARIANT]],
|
||||||
// CHECK-SAME: file: [[FILE:![0-9]*]], line: 14,
|
// CHECK-SAME: file: [[FILE:![0-9]*]], line: 15,
|
||||||
// CHECK-NOT: flags: DIFlagArtificial
|
// CHECK-NOT: flags: DIFlagArtificial
|
||||||
// CHECK-SAME: )
|
// CHECK-SAME: )
|
||||||
// CHECK: {{!.*}} = !DICompositeType(tag: DW_TAG_structure_type, name: "Unresumed", scope: [[GEN]],
|
// CHECK: {{!.*}} = !DICompositeType(tag: DW_TAG_structure_type, name: "Unresumed", scope: [[GEN]],
|
||||||
// CHECK-NOT: flags: DIFlagArtificial
|
// CHECK-NOT: flags: DIFlagArtificial
|
||||||
// CHECK-SAME: )
|
// CHECK-SAME: )
|
||||||
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "1", scope: [[VARIANT]],
|
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "1", scope: [[VARIANT]],
|
||||||
// CHECK-SAME: file: [[FILE]], line: 18,
|
// CHECK-SAME: file: [[FILE]], line: 19,
|
||||||
// CHECK-NOT: flags: DIFlagArtificial
|
// CHECK-NOT: flags: DIFlagArtificial
|
||||||
// CHECK-SAME: )
|
// CHECK-SAME: )
|
||||||
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "2", scope: [[VARIANT]],
|
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "2", scope: [[VARIANT]],
|
||||||
// CHECK-SAME: file: [[FILE]], line: 18,
|
// CHECK-SAME: file: [[FILE]], line: 19,
|
||||||
// CHECK-NOT: flags: DIFlagArtificial
|
// CHECK-NOT: flags: DIFlagArtificial
|
||||||
// CHECK-SAME: )
|
// CHECK-SAME: )
|
||||||
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "3", scope: [[VARIANT]],
|
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "3", scope: [[VARIANT]],
|
||||||
// CHECK-SAME: file: [[FILE]], line: 15,
|
// CHECK-SAME: file: [[FILE]], line: 16,
|
||||||
// CHECK-NOT: flags: DIFlagArtificial
|
// CHECK-NOT: flags: DIFlagArtificial
|
||||||
// CHECK-SAME: )
|
// CHECK-SAME: )
|
||||||
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "4", scope: [[VARIANT]],
|
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "4", scope: [[VARIANT]],
|
||||||
// CHECK-SAME: file: [[FILE]], line: 17,
|
// CHECK-SAME: file: [[FILE]], line: 18,
|
||||||
// CHECK-NOT: flags: DIFlagArtificial
|
// CHECK-NOT: flags: DIFlagArtificial
|
||||||
// CHECK-SAME: )
|
// CHECK-SAME: )
|
||||||
// CHECK: [[S1:!.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "Suspend1", scope: [[GEN]],
|
// CHECK: [[S1:!.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "Suspend1", scope: [[GEN]],
|
||||||
|
|
|
@ -6,8 +6,12 @@ struct A;
|
||||||
|
|
||||||
impl Drop for A {
|
impl Drop for A {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
extern "C" { fn foo(); }
|
extern "C" {
|
||||||
unsafe { foo(); }
|
fn foo();
|
||||||
|
}
|
||||||
|
unsafe {
|
||||||
|
foo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
//@ ignore-windows
|
//@ ignore-windows
|
||||||
//@ compile-flags: -C debuginfo=2
|
//@ compile-flags: -C debuginfo=2
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
fn main() {
|
fn main() {
|
||||||
unsafe {
|
unsafe {
|
||||||
// Column numbers are 1-based. Regression test for #65437.
|
// Column numbers are 1-based. Regression test for #65437.
|
||||||
|
@ -13,8 +14,8 @@ fn main() {
|
||||||
// CHECK: call void @turtle(){{( #[0-9]+)?}}, !dbg [[B:!.*]]
|
// CHECK: call void @turtle(){{( #[0-9]+)?}}, !dbg [[B:!.*]]
|
||||||
/* ż */ turtle();
|
/* ż */ turtle();
|
||||||
|
|
||||||
// CHECK: [[A]] = !DILocation(line: 10, column: 9,
|
// CHECK: [[A]] = !DILocation(line: 11, column: 9,
|
||||||
// CHECK: [[B]] = !DILocation(line: 14, column: 10,
|
// CHECK: [[B]] = !DILocation(line: 15, column: 10,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,6 @@
|
||||||
// NONMSVC-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "{closure_env#0}<debuginfo_generic_closure_env_names::Foo>", scope: ![[function_containing_closure_NAMESPACE]]
|
// NONMSVC-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "{closure_env#0}<debuginfo_generic_closure_env_names::Foo>", scope: ![[function_containing_closure_NAMESPACE]]
|
||||||
// MSVC-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "closure_env$0<debuginfo_generic_closure_env_names::Foo>", scope: ![[function_containing_closure_NAMESPACE]]
|
// MSVC-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "closure_env$0<debuginfo_generic_closure_env_names::Foo>", scope: ![[function_containing_closure_NAMESPACE]]
|
||||||
|
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
|
|
||||||
|
@ -72,9 +71,7 @@ async fn generic_async_function<T: 'static>(x: T) -> T {
|
||||||
|
|
||||||
fn generic_async_block<T: 'static>(x: T) -> impl Future<Output = T> {
|
fn generic_async_block<T: 'static>(x: T) -> impl Future<Output = T> {
|
||||||
static _X: u8 = 0; // Same as above
|
static _X: u8 = 0; // Same as above
|
||||||
async move {
|
async move { x }
|
||||||
x
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn instantiate_generics() {
|
pub fn instantiate_generics() {
|
||||||
|
|
|
@ -7,21 +7,19 @@ struct SomeUniqueName;
|
||||||
|
|
||||||
impl Drop for SomeUniqueName {
|
impl Drop for SomeUniqueName {
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
pub fn possibly_unwinding() {
|
pub fn possibly_unwinding() {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK-LABEL: @droppy
|
// CHECK-LABEL: @droppy
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn droppy() {
|
pub fn droppy() {
|
||||||
// Check that there are exactly 6 drop calls. The cleanups for the unwinding should be reused, so
|
// Check that there are exactly 6 drop calls. The cleanups for the unwinding should be reused,
|
||||||
// that's one new drop call per call to possibly_unwinding(), and finally 3 drop calls for the
|
// so that's one new drop call per call to possibly_unwinding(), and finally 3 drop calls for
|
||||||
// regular function exit. We used to have problems with quadratic growths of drop calls in such
|
// the regular function exit. We used to have problems with quadratic growths of drop calls in
|
||||||
// functions.
|
// such functions.
|
||||||
// FIXME(eddyb) the `void @` forces a match on the instruction, instead of the
|
// FIXME(eddyb) the `void @` forces a match on the instruction, instead of the
|
||||||
// comment, that's `; call core::ptr::drop_in_place::<drop::SomeUniqueName>`
|
// comment, that's `; call core::ptr::drop_in_place::<drop::SomeUniqueName>`
|
||||||
// for the `v0` mangling, should switch to matching on that once `legacy` is gone.
|
// for the `v0` mangling, should switch to matching on that once `legacy` is gone.
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
//@ compile-flags: -C no-prepopulate-passes -Copt-level=0
|
//@ compile-flags: -C no-prepopulate-passes -Copt-level=0
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
#![feature(extern_types)]
|
#![feature(extern_types)]
|
||||||
|
|
||||||
use std::ptr::addr_of;
|
use std::ptr::addr_of;
|
||||||
|
@ -11,8 +10,7 @@ use std::ptr::addr_of;
|
||||||
// Hack to get the correct type for usize
|
// Hack to get the correct type for usize
|
||||||
// CHECK: @helper([[USIZE:i[0-9]+]] %_1)
|
// CHECK: @helper([[USIZE:i[0-9]+]] %_1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn helper(_: usize) {
|
pub fn helper(_: usize) {}
|
||||||
}
|
|
||||||
|
|
||||||
struct Dst<T: ?Sized> {
|
struct Dst<T: ?Sized> {
|
||||||
x: u32,
|
x: u32,
|
||||||
|
@ -23,7 +21,8 @@ struct Dst<T: ?Sized> {
|
||||||
// CHECK: @dst_dyn_trait_offset(ptr align {{[0-9]+}} [[DATA_PTR:%.+]], ptr align {{[0-9]+}} [[VTABLE_PTR:%.+]])
|
// CHECK: @dst_dyn_trait_offset(ptr align {{[0-9]+}} [[DATA_PTR:%.+]], ptr align {{[0-9]+}} [[VTABLE_PTR:%.+]])
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn dst_dyn_trait_offset(s: &Dst<dyn Drop>) -> &dyn Drop {
|
pub fn dst_dyn_trait_offset(s: &Dst<dyn Drop>) -> &dyn Drop {
|
||||||
// The alignment of dyn trait is unknown, so we compute the offset based on align from the vtable.
|
// The alignment of dyn trait is unknown, so we compute the offset based on align from the
|
||||||
|
// vtable.
|
||||||
|
|
||||||
// CHECK: [[SIZE_PTR:%[0-9]+]] = getelementptr inbounds i8, ptr [[VTABLE_PTR]]
|
// CHECK: [[SIZE_PTR:%[0-9]+]] = getelementptr inbounds i8, ptr [[VTABLE_PTR]]
|
||||||
// CHECK: load [[USIZE]], ptr [[SIZE_PTR]]
|
// CHECK: load [[USIZE]], ptr [[SIZE_PTR]]
|
||||||
|
@ -70,7 +69,7 @@ pub fn packed_dst_slice_offset(s: &PackedDstSlice) -> *const [u16] {
|
||||||
addr_of!(s.z)
|
addr_of!(s.z)
|
||||||
}
|
}
|
||||||
|
|
||||||
extern {
|
extern "C" {
|
||||||
pub type Extern;
|
pub type Extern;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,15 @@ pub trait Trait {
|
||||||
fn f(&self);
|
fn f(&self);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct WrapperWithAlign1<T: ?Sized> { x: u8, y: T }
|
pub struct WrapperWithAlign1<T: ?Sized> {
|
||||||
|
x: u8,
|
||||||
|
y: T,
|
||||||
|
}
|
||||||
|
|
||||||
pub struct WrapperWithAlign2<T: ?Sized> { x: u16, y: T }
|
pub struct WrapperWithAlign2<T: ?Sized> {
|
||||||
|
x: u16,
|
||||||
|
y: T,
|
||||||
|
}
|
||||||
|
|
||||||
pub struct Struct<W: ?Sized> {
|
pub struct Struct<W: ?Sized> {
|
||||||
_field: i8,
|
_field: i8,
|
||||||
|
@ -22,7 +28,7 @@ pub struct Struct<W: ?Sized> {
|
||||||
// CHECK-LABEL: @eliminates_runtime_check_when_align_1
|
// CHECK-LABEL: @eliminates_runtime_check_when_align_1
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn eliminates_runtime_check_when_align_1(
|
pub fn eliminates_runtime_check_when_align_1(
|
||||||
x: &Struct<WrapperWithAlign1<dyn Trait>>
|
x: &Struct<WrapperWithAlign1<dyn Trait>>,
|
||||||
) -> &WrapperWithAlign1<dyn Trait> {
|
) -> &WrapperWithAlign1<dyn Trait> {
|
||||||
// CHECK: load [[USIZE:i[0-9]+]], {{.+}} !range [[RANGE_META:![0-9]+]]
|
// CHECK: load [[USIZE:i[0-9]+]], {{.+}} !range [[RANGE_META:![0-9]+]]
|
||||||
// CHECK-NOT: llvm.umax
|
// CHECK-NOT: llvm.umax
|
||||||
|
@ -35,7 +41,7 @@ pub fn eliminates_runtime_check_when_align_1(
|
||||||
// CHECK-LABEL: @does_not_eliminate_runtime_check_when_align_2
|
// CHECK-LABEL: @does_not_eliminate_runtime_check_when_align_2
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn does_not_eliminate_runtime_check_when_align_2(
|
pub fn does_not_eliminate_runtime_check_when_align_2(
|
||||||
x: &Struct<WrapperWithAlign2<dyn Trait>>
|
x: &Struct<WrapperWithAlign2<dyn Trait>>,
|
||||||
) -> &WrapperWithAlign2<dyn Trait> {
|
) -> &WrapperWithAlign2<dyn Trait> {
|
||||||
// CHECK: [[X0:%[0-9]+]] = load [[USIZE]], {{.+}} !range [[RANGE_META]]
|
// CHECK: [[X0:%[0-9]+]] = load [[USIZE]], {{.+}} !range [[RANGE_META]]
|
||||||
// CHECK: {{icmp|llvm.umax}}
|
// CHECK: {{icmp|llvm.umax}}
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
// A basic test function.
|
// A basic test function.
|
||||||
pub fn test() {
|
pub fn test() {}
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure the module flag ehcontguard is not present
|
// Ensure the module flag ehcontguard is not present
|
||||||
// CHECK-NOT: !"ehcontguard"
|
// CHECK-NOT: !"ehcontguard"
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
// A basic test function.
|
// A basic test function.
|
||||||
pub fn test() {
|
pub fn test() {}
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure the module flag ehcontguard=1 is present
|
// Ensure the module flag ehcontguard=1 is present
|
||||||
// CHECK: !"ehcontguard", i32 1
|
// CHECK: !"ehcontguard", i32 1
|
||||||
|
|
|
@ -9,18 +9,23 @@
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_core]
|
#![no_core]
|
||||||
|
|
||||||
#[lang="sized"] trait Sized { }
|
#[lang = "sized"]
|
||||||
#[lang="freeze"] trait Freeze { }
|
trait Sized {}
|
||||||
#[lang="copy"] trait Copy { }
|
#[lang = "freeze"]
|
||||||
|
trait Freeze {}
|
||||||
|
#[lang = "copy"]
|
||||||
|
trait Copy {}
|
||||||
|
|
||||||
#[rustc_intrinsic]
|
#[rustc_intrinsic]
|
||||||
fn size_of<T>() -> usize { loop {} }
|
fn size_of<T>() -> usize {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
extern "rust-intrinsic" {
|
extern "rust-intrinsic" {
|
||||||
fn catch_unwind(
|
fn catch_unwind(
|
||||||
try_fn: fn(_: *mut u8),
|
try_fn: fn(_: *mut u8),
|
||||||
data: *mut u8,
|
data: *mut u8,
|
||||||
catch_fn: fn(_: *mut u8, _: *mut u8)
|
catch_fn: fn(_: *mut u8, _: *mut u8),
|
||||||
) -> i32;
|
) -> i32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +41,7 @@ pub fn ptr_size() -> usize {
|
||||||
pub unsafe fn test_catch_unwind(
|
pub unsafe fn test_catch_unwind(
|
||||||
try_fn: fn(_: *mut u8),
|
try_fn: fn(_: *mut u8),
|
||||||
data: *mut u8,
|
data: *mut u8,
|
||||||
catch_fn: fn(_: *mut u8, _: *mut u8)
|
catch_fn: fn(_: *mut u8, _: *mut u8),
|
||||||
) -> i32 {
|
) -> i32 {
|
||||||
// CHECK: start:
|
// CHECK: start:
|
||||||
// CHECK: [[ALLOCA:%.*]] = alloca
|
// CHECK: [[ALLOCA:%.*]] = alloca
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
pub fn foo() {
|
pub fn foo() {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: !{{[0-9]+}} = !{i32 4, !"EnableSplitLTOUnit", i32 1}
|
// CHECK: !{{[0-9]+}} = !{i32 4, !"EnableSplitLTOUnit", i32 1}
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
pub enum Foo {
|
pub enum Foo {
|
||||||
A, B
|
A,
|
||||||
|
B,
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK-LABEL: @lookup
|
// CHECK-LABEL: @lookup
|
||||||
|
@ -15,7 +16,7 @@ pub fn lookup(buf: &[u8; 2], f: Foo) -> u8 {
|
||||||
|
|
||||||
pub enum Bar {
|
pub enum Bar {
|
||||||
A = 2,
|
A = 2,
|
||||||
B = 3
|
B = 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK-LABEL: @lookup_unmodified
|
// CHECK-LABEL: @lookup_unmodified
|
||||||
|
|
|
@ -17,7 +17,11 @@
|
||||||
#![allow(unused_variables)]
|
#![allow(unused_variables)]
|
||||||
#![allow(unused_assignments)]
|
#![allow(unused_assignments)]
|
||||||
|
|
||||||
enum E { A, B, C }
|
enum E {
|
||||||
|
A,
|
||||||
|
B,
|
||||||
|
C,
|
||||||
|
}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let e = E::C;
|
let e = E::C;
|
||||||
|
|
|
@ -23,7 +23,12 @@
|
||||||
#![allow(unused_variables)]
|
#![allow(unused_variables)]
|
||||||
#![allow(unused_assignments)]
|
#![allow(unused_assignments)]
|
||||||
|
|
||||||
enum E { A, B, C, D(bool) }
|
enum E {
|
||||||
|
A,
|
||||||
|
B,
|
||||||
|
C,
|
||||||
|
D(bool),
|
||||||
|
}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let e = E::D(true);
|
let e = E::D(true);
|
||||||
|
|
|
@ -21,7 +21,10 @@
|
||||||
#![allow(unused_variables)]
|
#![allow(unused_variables)]
|
||||||
#![allow(unused_assignments)]
|
#![allow(unused_assignments)]
|
||||||
|
|
||||||
enum E { A(u32), B(u32) }
|
enum E {
|
||||||
|
A(u32),
|
||||||
|
B(u32),
|
||||||
|
}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let e = E::A(23);
|
let e = E::A(23);
|
||||||
|
|
|
@ -50,6 +50,7 @@ pub fn match1(e: Enum1) -> u8 {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Case 2: Special cases don't apply.
|
// Case 2: Special cases don't apply.
|
||||||
|
#[rustfmt::skip]
|
||||||
pub enum X {
|
pub enum X {
|
||||||
_2=2, _3, _4, _5, _6, _7, _8, _9, _10, _11,
|
_2=2, _3, _4, _5, _6, _7, _8, _9, _10, _11,
|
||||||
_12, _13, _14, _15, _16, _17, _18, _19, _20,
|
_12, _13, _14, _15, _16, _17, _18, _19, _20,
|
||||||
|
|
|
@ -22,8 +22,7 @@ const C: Int = Int(153);
|
||||||
// CHECK-NEXT: ret i1 [[SPEC_SELECT]]
|
// CHECK-NEXT: ret i1 [[SPEC_SELECT]]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn implicit_match(x: Int) -> bool {
|
pub fn implicit_match(x: Int) -> bool {
|
||||||
(x >= A && x <= B)
|
(x >= A && x <= B) || x == C
|
||||||
|| x == C
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The code is from https://github.com/rust-lang/rust/issues/110097.
|
// The code is from https://github.com/rust-lang/rust/issues/110097.
|
||||||
|
@ -35,9 +34,5 @@ pub fn implicit_match(x: Int) -> bool {
|
||||||
// CHECK-NEXT: ret
|
// CHECK-NEXT: ret
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn if_let(val: Result<i32, ()>) -> Result<i32, ()> {
|
pub fn if_let(val: Result<i32, ()>) -> Result<i32, ()> {
|
||||||
if let Ok(x) = val {
|
if let Ok(x) = val { Ok(x) } else { Err(()) }
|
||||||
Ok(x)
|
|
||||||
} else {
|
|
||||||
Err(())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
#![feature(core_intrinsics)]
|
#![feature(core_intrinsics)]
|
||||||
|
|
||||||
use std::intrinsics::{fadd_fast, fsub_fast, fmul_fast, fdiv_fast, frem_fast};
|
use std::intrinsics::{fadd_fast, fdiv_fast, fmul_fast, frem_fast, fsub_fast};
|
||||||
|
|
||||||
// CHECK-LABEL: @add
|
// CHECK-LABEL: @add
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
@ -17,34 +17,26 @@ pub fn add(x: f32, y: f32) -> f32 {
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn addition(x: f32, y: f32) -> f32 {
|
pub fn addition(x: f32, y: f32) -> f32 {
|
||||||
// CHECK: fadd fast float
|
// CHECK: fadd fast float
|
||||||
unsafe {
|
unsafe { fadd_fast(x, y) }
|
||||||
fadd_fast(x, y)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK-LABEL: @subtraction
|
// CHECK-LABEL: @subtraction
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn subtraction(x: f32, y: f32) -> f32 {
|
pub fn subtraction(x: f32, y: f32) -> f32 {
|
||||||
// CHECK: fsub fast float
|
// CHECK: fsub fast float
|
||||||
unsafe {
|
unsafe { fsub_fast(x, y) }
|
||||||
fsub_fast(x, y)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK-LABEL: @multiplication
|
// CHECK-LABEL: @multiplication
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn multiplication(x: f32, y: f32) -> f32 {
|
pub fn multiplication(x: f32, y: f32) -> f32 {
|
||||||
// CHECK: fmul fast float
|
// CHECK: fmul fast float
|
||||||
unsafe {
|
unsafe { fmul_fast(x, y) }
|
||||||
fmul_fast(x, y)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK-LABEL: @division
|
// CHECK-LABEL: @division
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn division(x: f32, y: f32) -> f32 {
|
pub fn division(x: f32, y: f32) -> f32 {
|
||||||
// CHECK: fdiv fast float
|
// CHECK: fdiv fast float
|
||||||
unsafe {
|
unsafe { fdiv_fast(x, y) }
|
||||||
fdiv_fast(x, y)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ trait Sized { }
|
||||||
trait Copy {}
|
trait Copy {}
|
||||||
impl Copy for u32 {}
|
impl Copy for u32 {}
|
||||||
|
|
||||||
|
|
||||||
// CHECK: define i32 @peach{{.*}}[[PEACH_ATTRS:\#[0-9]+]] {
|
// CHECK: define i32 @peach{{.*}}[[PEACH_ATTRS:\#[0-9]+]] {
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn peach(x: u32) -> u32 {
|
pub fn peach(x: u32) -> u32 {
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
#![feature(dyn_star)]
|
#![feature(dyn_star)]
|
||||||
#![feature(allocator_api)]
|
#![feature(allocator_api)]
|
||||||
|
|
||||||
|
use std::marker::PhantomPinned;
|
||||||
use std::mem::MaybeUninit;
|
use std::mem::MaybeUninit;
|
||||||
use std::num::NonZero;
|
use std::num::NonZero;
|
||||||
use std::marker::PhantomPinned;
|
|
||||||
use std::ptr::NonNull;
|
use std::ptr::NonNull;
|
||||||
|
|
||||||
pub struct S {
|
pub struct S {
|
||||||
|
@ -83,8 +83,7 @@ pub fn option_nonzero_int(x: Option<NonZero<u64>>) -> Option<NonZero<u64>> {
|
||||||
// CHECK: @readonly_borrow(ptr noalias noundef readonly align 4 dereferenceable(4) %_1)
|
// CHECK: @readonly_borrow(ptr noalias noundef readonly align 4 dereferenceable(4) %_1)
|
||||||
// FIXME #25759 This should also have `nocapture`
|
// FIXME #25759 This should also have `nocapture`
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn readonly_borrow(_: &i32) {
|
pub fn readonly_borrow(_: &i32) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: noundef align 4 dereferenceable(4) ptr @readonly_borrow_ret()
|
// CHECK: noundef align 4 dereferenceable(4) ptr @readonly_borrow_ret()
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
@ -95,32 +94,27 @@ pub fn readonly_borrow_ret() -> &'static i32 {
|
||||||
// CHECK: @static_borrow(ptr noalias noundef readonly align 4 dereferenceable(4) %_1)
|
// CHECK: @static_borrow(ptr noalias noundef readonly align 4 dereferenceable(4) %_1)
|
||||||
// static borrow may be captured
|
// static borrow may be captured
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn static_borrow(_: &'static i32) {
|
pub fn static_borrow(_: &'static i32) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: @named_borrow(ptr noalias noundef readonly align 4 dereferenceable(4) %_1)
|
// CHECK: @named_borrow(ptr noalias noundef readonly align 4 dereferenceable(4) %_1)
|
||||||
// borrow with named lifetime may be captured
|
// borrow with named lifetime may be captured
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn named_borrow<'r>(_: &'r i32) {
|
pub fn named_borrow<'r>(_: &'r i32) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: @unsafe_borrow(ptr noundef nonnull align 2 %_1)
|
// CHECK: @unsafe_borrow(ptr noundef nonnull align 2 %_1)
|
||||||
// unsafe interior means this isn't actually readonly and there may be aliases ...
|
// unsafe interior means this isn't actually readonly and there may be aliases ...
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn unsafe_borrow(_: &UnsafeInner) {
|
pub fn unsafe_borrow(_: &UnsafeInner) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: @mutable_unsafe_borrow(ptr noalias noundef align 2 dereferenceable(2) %_1)
|
// CHECK: @mutable_unsafe_borrow(ptr noalias noundef align 2 dereferenceable(2) %_1)
|
||||||
// ... unless this is a mutable borrow, those never alias
|
// ... unless this is a mutable borrow, those never alias
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn mutable_unsafe_borrow(_: &mut UnsafeInner) {
|
pub fn mutable_unsafe_borrow(_: &mut UnsafeInner) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: @mutable_borrow(ptr noalias noundef align 4 dereferenceable(4) %_1)
|
// CHECK: @mutable_borrow(ptr noalias noundef align 4 dereferenceable(4) %_1)
|
||||||
// FIXME #25759 This should also have `nocapture`
|
// FIXME #25759 This should also have `nocapture`
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn mutable_borrow(_: &mut i32) {
|
pub fn mutable_borrow(_: &mut i32) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: noundef align 4 dereferenceable(4) ptr @mutable_borrow_ret()
|
// CHECK: noundef align 4 dereferenceable(4) ptr @mutable_borrow_ret()
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
@ -133,46 +127,37 @@ pub fn mutable_borrow_ret() -> &'static mut i32 {
|
||||||
// This one is *not* `noalias` because it might be self-referential.
|
// This one is *not* `noalias` because it might be self-referential.
|
||||||
// It is also not `dereferenceable` due to
|
// It is also not `dereferenceable` due to
|
||||||
// <https://github.com/rust-lang/unsafe-code-guidelines/issues/381>.
|
// <https://github.com/rust-lang/unsafe-code-guidelines/issues/381>.
|
||||||
pub fn mutable_notunpin_borrow(_: &mut NotUnpin) {
|
pub fn mutable_notunpin_borrow(_: &mut NotUnpin) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: @notunpin_borrow(ptr noalias noundef readonly align 4 dereferenceable(4) %_1)
|
// CHECK: @notunpin_borrow(ptr noalias noundef readonly align 4 dereferenceable(4) %_1)
|
||||||
// But `&NotUnpin` behaves perfectly normal.
|
// But `&NotUnpin` behaves perfectly normal.
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn notunpin_borrow(_: &NotUnpin) {
|
pub fn notunpin_borrow(_: &NotUnpin) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: @indirect_struct(ptr noalias nocapture noundef readonly align 4 dereferenceable(32) %_1)
|
// CHECK: @indirect_struct(ptr noalias nocapture noundef readonly align 4 dereferenceable(32) %_1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn indirect_struct(_: S) {
|
pub fn indirect_struct(_: S) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: @borrowed_struct(ptr noalias noundef readonly align 4 dereferenceable(32) %_1)
|
// CHECK: @borrowed_struct(ptr noalias noundef readonly align 4 dereferenceable(32) %_1)
|
||||||
// FIXME #25759 This should also have `nocapture`
|
// FIXME #25759 This should also have `nocapture`
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn borrowed_struct(_: &S) {
|
pub fn borrowed_struct(_: &S) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: @option_borrow(ptr noalias noundef readonly align 4 dereferenceable_or_null(4) %x)
|
// CHECK: @option_borrow(ptr noalias noundef readonly align 4 dereferenceable_or_null(4) %x)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn option_borrow(x: Option<&i32>) {
|
pub fn option_borrow(x: Option<&i32>) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: @option_borrow_mut(ptr noalias noundef align 4 dereferenceable_or_null(4) %x)
|
// CHECK: @option_borrow_mut(ptr noalias noundef align 4 dereferenceable_or_null(4) %x)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn option_borrow_mut(x: Option<&mut i32>) {
|
pub fn option_borrow_mut(x: Option<&mut i32>) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: @raw_struct(ptr noundef %_1)
|
// CHECK: @raw_struct(ptr noundef %_1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn raw_struct(_: *const S) {
|
pub fn raw_struct(_: *const S) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: @raw_option_nonnull_struct(ptr noundef %_1)
|
// CHECK: @raw_option_nonnull_struct(ptr noundef %_1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn raw_option_nonnull_struct(_: Option<NonNull<S>>) {
|
pub fn raw_option_nonnull_struct(_: Option<NonNull<S>>) {}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// `Box` can get deallocated during execution of the function, so it should
|
// `Box` can get deallocated during execution of the function, so it should
|
||||||
// not get `dereferenceable`.
|
// not get `dereferenceable`.
|
||||||
|
@ -200,71 +185,58 @@ pub fn notunpin_box(x: Box<NotUnpin>) -> Box<NotUnpin> {
|
||||||
// CHECK: @struct_return(ptr{{( dead_on_unwind)?}} noalias nocapture noundef{{( writable)?}} sret([32 x i8]) align 4 dereferenceable(32){{( %_0)?}})
|
// CHECK: @struct_return(ptr{{( dead_on_unwind)?}} noalias nocapture noundef{{( writable)?}} sret([32 x i8]) align 4 dereferenceable(32){{( %_0)?}})
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn struct_return() -> S {
|
pub fn struct_return() -> S {
|
||||||
S {
|
S { _field: [0, 0, 0, 0, 0, 0, 0, 0] }
|
||||||
_field: [0, 0, 0, 0, 0, 0, 0, 0]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hack to get the correct size for the length part in slices
|
// 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]+]] noundef %_1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn helper(_: usize) {
|
pub fn helper(_: usize) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: @slice(ptr noalias noundef nonnull readonly align 1 %_1.0, [[USIZE]] noundef %_1.1)
|
// CHECK: @slice(ptr noalias noundef nonnull readonly align 1 %_1.0, [[USIZE]] noundef %_1.1)
|
||||||
// FIXME #25759 This should also have `nocapture`
|
// FIXME #25759 This should also have `nocapture`
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn slice(_: &[u8]) {
|
pub fn slice(_: &[u8]) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: @mutable_slice(ptr noalias noundef nonnull align 1 %_1.0, [[USIZE]] noundef %_1.1)
|
// CHECK: @mutable_slice(ptr noalias noundef nonnull align 1 %_1.0, [[USIZE]] noundef %_1.1)
|
||||||
// FIXME #25759 This should also have `nocapture`
|
// FIXME #25759 This should also have `nocapture`
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn mutable_slice(_: &mut [u8]) {
|
pub fn mutable_slice(_: &mut [u8]) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: @unsafe_slice(ptr noundef nonnull align 2 %_1.0, [[USIZE]] noundef %_1.1)
|
// CHECK: @unsafe_slice(ptr noundef nonnull align 2 %_1.0, [[USIZE]] noundef %_1.1)
|
||||||
// unsafe interior means this isn't actually readonly and there may be aliases ...
|
// unsafe interior means this isn't actually readonly and there may be aliases ...
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn unsafe_slice(_: &[UnsafeInner]) {
|
pub fn unsafe_slice(_: &[UnsafeInner]) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: @raw_slice(ptr noundef %_1.0, [[USIZE]] noundef %_1.1)
|
// CHECK: @raw_slice(ptr noundef %_1.0, [[USIZE]] noundef %_1.1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn raw_slice(_: *const [u8]) {
|
pub fn raw_slice(_: *const [u8]) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: @str(ptr noalias noundef nonnull readonly align 1 %_1.0, [[USIZE]] noundef %_1.1)
|
// CHECK: @str(ptr noalias noundef nonnull readonly align 1 %_1.0, [[USIZE]] noundef %_1.1)
|
||||||
// FIXME #25759 This should also have `nocapture`
|
// FIXME #25759 This should also have `nocapture`
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn str(_: &[u8]) {
|
pub fn str(_: &[u8]) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: @trait_borrow(ptr noundef nonnull align 1 %_1.0, {{.+}} noalias noundef readonly align {{.*}} dereferenceable({{.*}}) %_1.1)
|
// CHECK: @trait_borrow(ptr noundef nonnull align 1 %_1.0, {{.+}} noalias noundef readonly align {{.*}} dereferenceable({{.*}}) %_1.1)
|
||||||
// FIXME #25759 This should also have `nocapture`
|
// FIXME #25759 This should also have `nocapture`
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn trait_borrow(_: &dyn Drop) {
|
pub fn trait_borrow(_: &dyn Drop) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: @option_trait_borrow(ptr noundef align 1 %x.0, ptr %x.1)
|
// CHECK: @option_trait_borrow(ptr noundef align 1 %x.0, ptr %x.1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn option_trait_borrow(x: Option<&dyn Drop>) {
|
pub fn option_trait_borrow(x: Option<&dyn Drop>) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: @option_trait_borrow_mut(ptr noundef align 1 %x.0, ptr %x.1)
|
// CHECK: @option_trait_borrow_mut(ptr noundef align 1 %x.0, ptr %x.1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn option_trait_borrow_mut(x: Option<&mut dyn Drop>) {
|
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)
|
// CHECK: @trait_raw(ptr noundef %_1.0, {{.+}} noalias noundef readonly align {{.*}} dereferenceable({{.*}}) %_1.1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn trait_raw(_: *const dyn Drop) {
|
pub fn trait_raw(_: *const dyn Drop) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: @trait_box(ptr noalias noundef nonnull align 1{{( %0)?}}, {{.+}} noalias noundef readonly align {{.*}} dereferenceable({{.*}}){{( %1)?}})
|
// CHECK: @trait_box(ptr noalias noundef nonnull align 1{{( %0)?}}, {{.+}} noalias noundef readonly align {{.*}} dereferenceable({{.*}}){{( %1)?}})
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn trait_box(_: Box<dyn Drop + Unpin>) {
|
pub fn trait_box(_: Box<dyn Drop + Unpin>) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: { ptr, ptr } @trait_option(ptr noalias noundef align 1 %x.0, ptr %x.1)
|
// CHECK: { ptr, ptr } @trait_option(ptr noalias noundef align 1 %x.0, ptr %x.1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
|
|
@ -15,9 +15,7 @@
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
fn some_function() {
|
fn some_function() {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn some_other_function() {
|
pub fn some_other_function() {
|
||||||
some_function();
|
some_function();
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
|
||||||
pub struct S1<'a> {
|
pub struct S1<'a> {
|
||||||
data: &'a [u8],
|
data: &'a [u8],
|
||||||
position: usize,
|
position: usize,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
//@ compile-flags: -C no-prepopulate-passes -Zmir-opt-level=0
|
//@ compile-flags: -C no-prepopulate-passes -Zmir-opt-level=0
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
|
|
||||||
// We want to make sure that closures get 'internal' linkage instead of
|
// We want to make sure that closures get 'internal' linkage instead of
|
||||||
// 'weak_odr' when they are not shared between codegen units
|
// 'weak_odr' when they are not shared between codegen units
|
||||||
// FIXME(eddyb) `legacy` mangling uses `{{closure}}`, while `v0`
|
// FIXME(eddyb) `legacy` mangling uses `{{closure}}`, while `v0`
|
||||||
|
@ -9,6 +8,6 @@ pub fn main() {
|
||||||
// CHECK-LABEL: ; internalize_closures::main::{{.*}}closure
|
// CHECK-LABEL: ; internalize_closures::main::{{.*}}closure
|
||||||
// CHECK-NEXT: ; Function Attrs:
|
// CHECK-NEXT: ; Function Attrs:
|
||||||
// CHECK-NEXT: define internal
|
// CHECK-NEXT: define internal
|
||||||
let c = |x:i32| { x + 1 };
|
let c = |x: i32| x + 1;
|
||||||
let _ = c(1);
|
let _ = c(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,5 +8,7 @@ extern "rust-intrinsic" {
|
||||||
// CHECK: @llvm.sqrt.f32(float) #{{[0-9]*}}
|
// CHECK: @llvm.sqrt.f32(float) #{{[0-9]*}}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
unsafe { sqrtf32(0.0f32); }
|
unsafe {
|
||||||
|
sqrtf32(0.0f32);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,14 @@
|
||||||
|
|
||||||
use std::intrinsics::const_eval_select;
|
use std::intrinsics::const_eval_select;
|
||||||
|
|
||||||
const fn foo(_: i32) -> i32 { 1 }
|
const fn foo(_: i32) -> i32 {
|
||||||
|
1
|
||||||
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn hi(n: i32) -> i32 { n }
|
pub fn hi(n: i32) -> i32 {
|
||||||
|
n
|
||||||
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe fn hey() {
|
pub unsafe fn hey() {
|
||||||
|
|
|
@ -9,11 +9,7 @@ use std::intrinsics::{likely,unlikely};
|
||||||
pub fn check_likely(x: i32, y: i32) -> Option<i32> {
|
pub fn check_likely(x: i32, y: i32) -> Option<i32> {
|
||||||
unsafe {
|
unsafe {
|
||||||
// CHECK: call i1 @llvm.expect.i1(i1 %{{.*}}, i1 true)
|
// CHECK: call i1 @llvm.expect.i1(i1 %{{.*}}, i1 true)
|
||||||
if likely(x == y) {
|
if likely(x == y) { None } else { Some(x + y) }
|
||||||
None
|
|
||||||
} else {
|
|
||||||
Some(x + y)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,10 +17,6 @@ pub fn check_likely(x: i32, y: i32) -> Option<i32> {
|
||||||
pub fn check_unlikely(x: i32, y: i32) -> Option<i32> {
|
pub fn check_unlikely(x: i32, y: i32) -> Option<i32> {
|
||||||
unsafe {
|
unsafe {
|
||||||
// CHECK: call i1 @llvm.expect.i1(i1 %{{.*}}, i1 false)
|
// CHECK: call i1 @llvm.expect.i1(i1 %{{.*}}, i1 false)
|
||||||
if unlikely(x == y) {
|
if unlikely(x == y) { None } else { Some(x + y) }
|
||||||
None
|
|
||||||
} else {
|
|
||||||
Some(x + y)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,9 @@
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
#![feature(core_intrinsics)]
|
#![feature(core_intrinsics)]
|
||||||
|
|
||||||
use std::intrinsics::{prefetch_read_data, prefetch_write_data,
|
use std::intrinsics::{
|
||||||
prefetch_read_instruction, prefetch_write_instruction};
|
prefetch_read_data, prefetch_read_instruction, prefetch_write_data, prefetch_write_instruction,
|
||||||
|
};
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn check_prefetch_read_data(data: &[i8]) {
|
pub fn check_prefetch_read_data(data: &[i8]) {
|
||||||
|
|
|
@ -9,9 +9,5 @@ pub fn test(a: i32, b: i32) -> bool {
|
||||||
let c1 = (a >= 0) && (a <= 10);
|
let c1 = (a >= 0) && (a <= 10);
|
||||||
let c2 = (b >= 0) && (b <= 20);
|
let c2 = (b >= 0) && (b <= 20);
|
||||||
|
|
||||||
if c1 & c2 {
|
if c1 & c2 { a + 100 != b } else { true }
|
||||||
a + 100 != b
|
|
||||||
} else {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,8 @@ pub struct S([usize; 8]);
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn outer_function(x: S, y: S) -> usize {
|
pub fn outer_function(x: S, y: S) -> usize {
|
||||||
(#[inline(always)]|| {
|
(#[inline(always)]
|
||||||
|
|| {
|
||||||
let _z = x;
|
let _z = x;
|
||||||
y.0[0]
|
y.0[0]
|
||||||
})()
|
})()
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
//@ only-64bit (because the LLVM type of i64 for usize shows up)
|
//@ only-64bit (because the LLVM type of i64 for usize shows up)
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
use core::ptr::NonNull;
|
|
||||||
use core::num::NonZero;
|
use core::num::NonZero;
|
||||||
|
use core::ptr::NonNull;
|
||||||
|
|
||||||
// CHECK-LABEL: @check_non_null
|
// CHECK-LABEL: @check_non_null
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
|
|
@ -9,8 +9,7 @@ struct Foo;
|
||||||
impl Foo {
|
impl Foo {
|
||||||
// CHECK: define internal x86_stdcallcc void @{{.*}}foo{{.*}}()
|
// CHECK: define internal x86_stdcallcc void @{{.*}}foo{{.*}}()
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
pub extern "stdcall" fn foo<T>() {
|
pub extern "stdcall" fn foo<T>() {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -6,4 +6,6 @@ pub struct Foo(u64);
|
||||||
|
|
||||||
// CHECK: define {{.*}} @foo(
|
// CHECK: define {{.*}} @foo(
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn foo(_: Foo) -> Foo { loop {} }
|
pub extern "C" fn foo(_: Foo) -> Foo {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
|
@ -12,11 +12,7 @@ pub enum All {
|
||||||
// CHECK-LABEL: @issue_73031
|
// CHECK-LABEL: @issue_73031
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn issue_73031(a: &mut All, q: i32) -> i32 {
|
pub fn issue_73031(a: &mut All, q: i32) -> i32 {
|
||||||
*a = if q == 5 {
|
*a = if q == 5 { All::Foo } else { All::Bar };
|
||||||
All::Foo
|
|
||||||
} else {
|
|
||||||
All::Bar
|
|
||||||
};
|
|
||||||
match *a {
|
match *a {
|
||||||
// CHECK-NOT: panic
|
// CHECK-NOT: panic
|
||||||
All::None => panic!(),
|
All::None => panic!(),
|
||||||
|
|
|
@ -7,7 +7,10 @@
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
pub enum Foo {
|
pub enum Foo {
|
||||||
A, B, C, D,
|
A,
|
||||||
|
B,
|
||||||
|
C,
|
||||||
|
D,
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK-LABEL: @issue_73258(
|
// CHECK-LABEL: @issue_73258(
|
||||||
|
|
|
@ -12,11 +12,7 @@ pub fn position_slice_to_no_bounds_check(s: &[u8]) -> &[u8] {
|
||||||
// CHECK-NOT: slice_end_index_len_fail
|
// CHECK-NOT: slice_end_index_len_fail
|
||||||
// CHECK-NOT: panic_bounds_check
|
// CHECK-NOT: panic_bounds_check
|
||||||
// CHECK-NOT: unreachable
|
// CHECK-NOT: unreachable
|
||||||
if let Some(idx) = s.iter().position(|b| *b == b'\\') {
|
if let Some(idx) = s.iter().position(|b| *b == b'\\') { &s[..idx] } else { s }
|
||||||
&s[..idx]
|
|
||||||
} else {
|
|
||||||
s
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK-LABEL: @position_slice_from_no_bounds_check
|
// CHECK-LABEL: @position_slice_from_no_bounds_check
|
||||||
|
@ -27,11 +23,7 @@ pub fn position_slice_from_no_bounds_check(s: &[u8]) -> &[u8] {
|
||||||
// CHECK-NOT: slice_end_index_len_fail
|
// CHECK-NOT: slice_end_index_len_fail
|
||||||
// CHECK-NOT: panic_bounds_check
|
// CHECK-NOT: panic_bounds_check
|
||||||
// CHECK-NOT: unreachable
|
// CHECK-NOT: unreachable
|
||||||
if let Some(idx) = s.iter().position(|b| *b == b'\\') {
|
if let Some(idx) = s.iter().position(|b| *b == b'\\') { &s[idx..] } else { s }
|
||||||
&s[idx..]
|
|
||||||
} else {
|
|
||||||
s
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK-LABEL: @position_index_no_bounds_check
|
// CHECK-LABEL: @position_index_no_bounds_check
|
||||||
|
@ -42,11 +34,7 @@ pub fn position_index_no_bounds_check(s: &[u8]) -> u8 {
|
||||||
// CHECK-NOT: slice_end_index_len_fail
|
// CHECK-NOT: slice_end_index_len_fail
|
||||||
// CHECK-NOT: panic_bounds_check
|
// CHECK-NOT: panic_bounds_check
|
||||||
// CHECK-NOT: unreachable
|
// CHECK-NOT: unreachable
|
||||||
if let Some(idx) = s.iter().position(|b| *b == b'\\') {
|
if let Some(idx) = s.iter().position(|b| *b == b'\\') { s[idx] } else { 42 }
|
||||||
s[idx]
|
|
||||||
} else {
|
|
||||||
42
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// CHECK-LABEL: @rposition_slice_to_no_bounds_check
|
// CHECK-LABEL: @rposition_slice_to_no_bounds_check
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
@ -56,11 +44,7 @@ pub fn rposition_slice_to_no_bounds_check(s: &[u8]) -> &[u8] {
|
||||||
// CHECK-NOT: slice_end_index_len_fail
|
// CHECK-NOT: slice_end_index_len_fail
|
||||||
// CHECK-NOT: panic_bounds_check
|
// CHECK-NOT: panic_bounds_check
|
||||||
// CHECK-NOT: unreachable
|
// CHECK-NOT: unreachable
|
||||||
if let Some(idx) = s.iter().rposition(|b| *b == b'\\') {
|
if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { &s[..idx] } else { s }
|
||||||
&s[..idx]
|
|
||||||
} else {
|
|
||||||
s
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK-LABEL: @rposition_slice_from_no_bounds_check
|
// CHECK-LABEL: @rposition_slice_from_no_bounds_check
|
||||||
|
@ -71,11 +55,7 @@ pub fn rposition_slice_from_no_bounds_check(s: &[u8]) -> &[u8] {
|
||||||
// CHECK-NOT: slice_end_index_len_fail
|
// CHECK-NOT: slice_end_index_len_fail
|
||||||
// CHECK-NOT: panic_bounds_check
|
// CHECK-NOT: panic_bounds_check
|
||||||
// CHECK-NOT: unreachable
|
// CHECK-NOT: unreachable
|
||||||
if let Some(idx) = s.iter().rposition(|b| *b == b'\\') {
|
if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { &s[idx..] } else { s }
|
||||||
&s[idx..]
|
|
||||||
} else {
|
|
||||||
s
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK-LABEL: @rposition_index_no_bounds_check
|
// CHECK-LABEL: @rposition_index_no_bounds_check
|
||||||
|
@ -86,9 +66,5 @@ pub fn rposition_index_no_bounds_check(s: &[u8]) -> u8 {
|
||||||
// CHECK-NOT: slice_end_index_len_fail
|
// CHECK-NOT: slice_end_index_len_fail
|
||||||
// CHECK-NOT: panic_bounds_check
|
// CHECK-NOT: panic_bounds_check
|
||||||
// CHECK-NOT: unreachable
|
// CHECK-NOT: unreachable
|
||||||
if let Some(idx) = s.iter().rposition(|b| *b == b'\\') {
|
if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { s[idx] } else { 42 }
|
||||||
s[idx]
|
|
||||||
} else {
|
|
||||||
42
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,9 @@ pub fn issue_75546() {
|
||||||
let mut i = 1u32;
|
let mut i = 1u32;
|
||||||
while i < u32::MAX {
|
while i < u32::MAX {
|
||||||
// CHECK-NOT: panic
|
// CHECK-NOT: panic
|
||||||
if i == 0 { panic!(); }
|
if i == 0 {
|
||||||
|
panic!();
|
||||||
|
}
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ pub enum Variant {
|
||||||
Two,
|
Two,
|
||||||
}
|
}
|
||||||
|
|
||||||
extern {
|
extern "C" {
|
||||||
fn exf1();
|
fn exf1();
|
||||||
fn exf2();
|
fn exf2();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,5 @@ pub struct M([i32; 4]);
|
||||||
pub fn is_infinite(v: V) -> M {
|
pub fn is_infinite(v: V) -> M {
|
||||||
// CHECK: fabs
|
// CHECK: fabs
|
||||||
// CHECK: cmp oeq
|
// CHECK: cmp oeq
|
||||||
unsafe {
|
unsafe { simd_eq(simd_fabs(v), V([f32::INFINITY; 4])) }
|
||||||
simd_eq(simd_fabs(v), V([f32::INFINITY; 4]))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,5 @@
|
||||||
pub fn test(dividend: i64, divisor: i64) -> Option<i64> {
|
pub fn test(dividend: i64, divisor: i64) -> Option<i64> {
|
||||||
// CHECK-LABEL: @test(
|
// CHECK-LABEL: @test(
|
||||||
// CHECK-NOT: panic
|
// CHECK-NOT: panic
|
||||||
if dividend > i64::min_value() && divisor != 0 {
|
if dividend > i64::min_value() && divisor != 0 { Some(dividend / divisor) } else { None }
|
||||||
Some(dividend / divisor)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
//@ only-x86_64 (vectorization varies between architectures)
|
//@ only-x86_64 (vectorization varies between architectures)
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
|
||||||
// Ensure that slice + take + sum gets vectorized.
|
// Ensure that slice + take + sum gets vectorized.
|
||||||
// Currently this relies on the slice::Iter::try_fold implementation
|
// Currently this relies on the slice::Iter::try_fold implementation
|
||||||
// CHECK-LABEL: @slice_take_sum
|
// CHECK-LABEL: @slice_take_sum
|
||||||
|
|
|
@ -8,15 +8,21 @@
|
||||||
// CHECK-LABEL: ; link_dead_code::const_fn
|
// CHECK-LABEL: ; link_dead_code::const_fn
|
||||||
// CHECK-NEXT: ; Function Attrs:
|
// CHECK-NEXT: ; Function Attrs:
|
||||||
// CHECK-NEXT: define hidden
|
// CHECK-NEXT: define hidden
|
||||||
const fn const_fn() -> i32 { 1 }
|
const fn const_fn() -> i32 {
|
||||||
|
1
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK-LABEL: ; link_dead_code::inline_fn
|
// CHECK-LABEL: ; link_dead_code::inline_fn
|
||||||
// CHECK-NEXT: ; Function Attrs:
|
// CHECK-NEXT: ; Function Attrs:
|
||||||
// CHECK-NEXT: define hidden
|
// CHECK-NEXT: define hidden
|
||||||
#[inline]
|
#[inline]
|
||||||
fn inline_fn() -> i32 { 2 }
|
fn inline_fn() -> i32 {
|
||||||
|
2
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK-LABEL: ; link_dead_code::private_fn
|
// CHECK-LABEL: ; link_dead_code::private_fn
|
||||||
// CHECK-NEXT: ; Function Attrs:
|
// CHECK-NEXT: ; Function Attrs:
|
||||||
// CHECK-NEXT: define hidden
|
// CHECK-NEXT: define hidden
|
||||||
fn private_fn() -> i32 { 3 }
|
fn private_fn() -> i32 {
|
||||||
|
3
|
||||||
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ pub static VAR1: u32 = 0x01000000;
|
||||||
|
|
||||||
pub enum E {
|
pub enum E {
|
||||||
A(u32),
|
A(u32),
|
||||||
B(f32)
|
B(f32),
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK: @VAR2 = {{(dso_local )?}}constant {{.*}}, section ".test_two"
|
// CHECK: @VAR2 = {{(dso_local )?}}constant {{.*}}, section ".test_two"
|
||||||
|
|
|
@ -6,9 +6,12 @@
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_core]
|
#![no_core]
|
||||||
|
|
||||||
#[lang="sized"] trait Sized { }
|
#[lang = "sized"]
|
||||||
#[lang="freeze"] trait Freeze { }
|
trait Sized {}
|
||||||
#[lang="copy"] trait Copy { }
|
#[lang = "freeze"]
|
||||||
|
trait Freeze {}
|
||||||
|
#[lang = "copy"]
|
||||||
|
trait Copy {}
|
||||||
|
|
||||||
// CHECK: define void @f_fpr_tracking(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, i8 noundef zeroext %i)
|
// CHECK: define void @f_fpr_tracking(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, i8 noundef zeroext %i)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
|
|
@ -2,10 +2,19 @@
|
||||||
//@ compile-flags: -O
|
//@ compile-flags: -O
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
pub enum Three { A, B, C }
|
pub enum Three {
|
||||||
|
A,
|
||||||
|
B,
|
||||||
|
C,
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(u16)]
|
#[repr(u16)]
|
||||||
pub enum Four { A, B, C, D }
|
pub enum Four {
|
||||||
|
A,
|
||||||
|
B,
|
||||||
|
C,
|
||||||
|
D,
|
||||||
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn three_valued(x: Three) -> Three {
|
pub fn three_valued(x: Three) -> Three {
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
struct Zst { phantom: PhantomData<Zst> }
|
struct Zst {
|
||||||
|
phantom: PhantomData<Zst>,
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK-LABEL: @mir
|
// CHECK-LABEL: @mir
|
||||||
// CHECK-NOT: store{{.*}}undef
|
// CHECK-NOT: store{{.*}}undef
|
||||||
|
|
|
@ -14,8 +14,7 @@ pub unsafe extern "C" fn naked_empty() {
|
||||||
// CHECK-NEXT: {{.+}}:
|
// CHECK-NEXT: {{.+}}:
|
||||||
// CHECK-NEXT: call void asm
|
// CHECK-NEXT: call void asm
|
||||||
// CHECK-NEXT: unreachable
|
// CHECK-NEXT: unreachable
|
||||||
asm!("ret",
|
asm!("ret", options(noreturn));
|
||||||
options(noreturn));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK: Function Attrs: naked
|
// CHECK: Function Attrs: naked
|
||||||
|
@ -26,7 +25,5 @@ pub unsafe extern "C" fn naked_with_args_and_return(a: isize, b: isize) -> isize
|
||||||
// CHECK-NEXT: {{.+}}:
|
// CHECK-NEXT: {{.+}}:
|
||||||
// CHECK-NEXT: call void asm
|
// CHECK-NEXT: call void asm
|
||||||
// CHECK-NEXT: unreachable
|
// CHECK-NEXT: unreachable
|
||||||
asm!("lea rax, [rdi + rsi]",
|
asm!("lea rax, [rdi + rsi]", "ret", options(noreturn));
|
||||||
"ret",
|
|
||||||
options(noreturn));
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,9 @@
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
fn project<T>(x: &(T,)) -> &T { &x.0 }
|
fn project<T>(x: &(T,)) -> &T {
|
||||||
|
&x.0
|
||||||
|
}
|
||||||
|
|
||||||
fn dummy() {}
|
fn dummy() {}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
pub struct SelfRef {
|
pub struct SelfRef {
|
||||||
self_ref: *mut SelfRef,
|
self_ref: *mut SelfRef,
|
||||||
_pin: std::marker::PhantomPinned
|
_pin: std::marker::PhantomPinned,
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK-LABEL: @test_self_ref(
|
// CHECK-LABEL: @test_self_ref(
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
//@ compile-flags: -C opt-level=3
|
//@ compile-flags: -C opt-level=3
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
#![allow(unconditional_recursion)]
|
#![allow(unconditional_recursion)]
|
||||||
|
|
||||||
// CHECK-LABEL: @infinite_recursion
|
// CHECK-LABEL: @infinite_recursion
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
extern crate core;
|
extern crate core;
|
||||||
use core::cmp::Ordering;
|
use core::cmp::Ordering;
|
||||||
use core::ptr::NonNull;
|
|
||||||
use core::num::NonZero;
|
use core::num::NonZero;
|
||||||
|
use core::ptr::NonNull;
|
||||||
|
|
||||||
// CHECK-LABEL: @non_zero_eq
|
// CHECK-LABEL: @non_zero_eq
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
|
|
@ -6,13 +6,13 @@
|
||||||
#[repr(packed)]
|
#[repr(packed)]
|
||||||
pub struct Packed1 {
|
pub struct Packed1 {
|
||||||
dealign: u8,
|
dealign: u8,
|
||||||
data: u32
|
data: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(packed(2))]
|
#[repr(packed(2))]
|
||||||
pub struct Packed2 {
|
pub struct Packed2 {
|
||||||
dealign: u8,
|
dealign: u8,
|
||||||
data: u32
|
data: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK-LABEL: @write_pkd1
|
// CHECK-LABEL: @write_pkd1
|
||||||
|
@ -39,13 +39,13 @@ pub struct Array([i32; 8]);
|
||||||
#[repr(packed)]
|
#[repr(packed)]
|
||||||
pub struct BigPacked1 {
|
pub struct BigPacked1 {
|
||||||
dealign: u8,
|
dealign: u8,
|
||||||
data: Array
|
data: Array,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(packed(2))]
|
#[repr(packed(2))]
|
||||||
pub struct BigPacked2 {
|
pub struct BigPacked2 {
|
||||||
dealign: u8,
|
dealign: u8,
|
||||||
data: Array
|
data: Array,
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK-LABEL: @call_pkd1
|
// CHECK-LABEL: @call_pkd1
|
||||||
|
|
|
@ -8,11 +8,9 @@
|
||||||
// CHECK: Function Attrs: nounwind uwtable
|
// CHECK: Function Attrs: nounwind uwtable
|
||||||
// CHECK-NEXT: define void @normal_uwtable()
|
// CHECK-NEXT: define void @normal_uwtable()
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn normal_uwtable() {
|
pub fn normal_uwtable() {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: Function Attrs: nounwind uwtable
|
// CHECK: Function Attrs: nounwind uwtable
|
||||||
// CHECK-NEXT: define void @extern_uwtable()
|
// CHECK-NEXT: define void @extern_uwtable()
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern fn extern_uwtable() {
|
pub extern "C" fn extern_uwtable() {}
|
||||||
}
|
|
||||||
|
|
|
@ -9,13 +9,11 @@ struct S;
|
||||||
|
|
||||||
impl Drop for S {
|
impl Drop for S {
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
fn might_unwind() {
|
fn might_unwind() {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK-LABEL: @test
|
// CHECK-LABEL: @test
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
|
|
@ -13,9 +13,7 @@
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
fn some_function() {
|
fn some_function() {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn some_other_function() {
|
pub fn some_other_function() {
|
||||||
some_function();
|
some_function();
|
||||||
|
|
|
@ -5,15 +5,15 @@
|
||||||
// CHECK: define i8 @call_foreign_fn()
|
// CHECK: define i8 @call_foreign_fn()
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn call_foreign_fn() -> u8 {
|
pub fn call_foreign_fn() -> u8 {
|
||||||
unsafe {
|
unsafe { foreign_fn() }
|
||||||
foreign_fn()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// (Allow but do not require `zeroext` here, because it is not worth effort to
|
// (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.)
|
// spell out which targets have it and which ones do not; see rust#97800.)
|
||||||
|
|
||||||
// CHECK: declare{{( zeroext)?}} i8 @foreign_fn()
|
// CHECK: declare{{( zeroext)?}} i8 @foreign_fn()
|
||||||
extern "C" {fn foreign_fn() -> u8;}
|
extern "C" {
|
||||||
|
fn foreign_fn() -> u8;
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: !{i32 {{[78]}}, !"PIC Level", i32 2}
|
// CHECK: !{i32 {{[78]}}, !"PIC Level", i32 2}
|
||||||
|
|
|
@ -8,15 +8,15 @@
|
||||||
// CHECK: define dso_local i8 @call_foreign_fn()
|
// CHECK: define dso_local i8 @call_foreign_fn()
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn call_foreign_fn() -> u8 {
|
pub fn call_foreign_fn() -> u8 {
|
||||||
unsafe {
|
unsafe { foreign_fn() }
|
||||||
foreign_fn()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// External functions are still marked as non-dso_local, since we don't know if the symbol
|
// 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.
|
// is defined in the binary or in the shared library.
|
||||||
// CHECK: declare zeroext i8 @foreign_fn()
|
// CHECK: declare zeroext i8 @foreign_fn()
|
||||||
extern "C" {fn foreign_fn() -> u8;}
|
extern "C" {
|
||||||
|
fn foreign_fn() -> u8;
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: !{i32 {{[78]}}, !"PIC Level", i32 2}
|
// CHECK: !{i32 {{[78]}}, !"PIC Level", i32 2}
|
||||||
// CHECK: !{i32 7, !"PIE Level", i32 2}
|
// CHECK: !{i32 7, !"PIE Level", i32 2}
|
||||||
|
|
|
@ -23,7 +23,7 @@ pub struct Align8 {
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct Transparent8 {
|
pub struct Transparent8 {
|
||||||
a: Align8
|
a: Align8,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
@ -45,7 +45,7 @@ pub struct Align16 {
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct Transparent16 {
|
pub struct Transparent16 {
|
||||||
a: Align16
|
a: Align16,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
@ -69,7 +69,7 @@ pub struct Align32 {
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct Transparent32 {
|
pub struct Transparent32 {
|
||||||
a: Align32
|
a: Align32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
@ -83,9 +83,15 @@ extern "C" {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn main(
|
pub unsafe fn main(
|
||||||
a1: Align8, a2: Transparent8, a3: Wrapped8,
|
a1: Align8,
|
||||||
b1: Align16, b2: Transparent16, b3: Wrapped16,
|
a2: Transparent8,
|
||||||
c1: Align32, c2: Transparent32, c3: Wrapped32,
|
a3: Wrapped8,
|
||||||
|
b1: Align16,
|
||||||
|
b2: Transparent16,
|
||||||
|
b3: Wrapped16,
|
||||||
|
c1: Align32,
|
||||||
|
c2: Transparent32,
|
||||||
|
c3: Wrapped32,
|
||||||
) {
|
) {
|
||||||
test_8(a1, a2, a3);
|
test_8(a1, a2, a3);
|
||||||
test_16(b1, b2, b3);
|
test_16(b1, b2, b3);
|
||||||
|
|
|
@ -21,7 +21,5 @@ use std::ptr::NonNull;
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe fn nonnull_new(ptr: *mut u8) -> NonNull<u8> {
|
pub unsafe fn nonnull_new(ptr: *mut u8) -> NonNull<u8> {
|
||||||
// CHECK: ; call core::ptr::non_null::NonNull<T>::new_unchecked
|
// CHECK: ; call core::ptr::non_null::NonNull<T>::new_unchecked
|
||||||
unsafe {
|
unsafe { NonNull::new_unchecked(ptr) }
|
||||||
NonNull::new_unchecked(ptr)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,7 @@
|
||||||
// Hack to get the correct size for the length part in slices
|
// Hack to get the correct size for the length part in slices
|
||||||
// CHECK: @helper([[USIZE:i[0-9]+]] %_1)
|
// CHECK: @helper([[USIZE:i[0-9]+]] %_1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn helper(_: usize) {
|
pub fn helper(_: usize) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK-LABEL: @ref_dst
|
// CHECK-LABEL: @ref_dst
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
|
|
@ -26,15 +26,17 @@
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_core]
|
#![no_core]
|
||||||
|
|
||||||
#[lang="sized"] trait Sized { }
|
#[lang = "sized"]
|
||||||
#[lang="freeze"] trait Freeze { }
|
trait Sized {}
|
||||||
#[lang="copy"] trait Copy { }
|
#[lang = "freeze"]
|
||||||
|
trait Freeze {}
|
||||||
|
#[lang = "copy"]
|
||||||
|
trait Copy {}
|
||||||
|
|
||||||
impl Copy for [u32; 16] {}
|
impl Copy for [u32; 16] {}
|
||||||
impl Copy for BigS {}
|
impl Copy for BigS {}
|
||||||
impl Copy for BigU {}
|
impl Copy for BigU {}
|
||||||
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct BigS([u32; 16]);
|
pub struct BigS([u32; 16]);
|
||||||
|
|
||||||
|
@ -53,20 +55,27 @@ pub enum TeBigS {
|
||||||
|
|
||||||
// CHECK: define void @test_BigS(ptr [[BIGS_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGS_RET_ATTRS2:.*]], [16 x i32]
|
// CHECK: define void @test_BigS(ptr [[BIGS_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGS_RET_ATTRS2:.*]], [16 x i32]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern fn test_BigS(_: BigS) -> BigS { loop {} }
|
pub extern "C" fn test_BigS(_: BigS) -> BigS {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: define void @test_TsBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], [16 x i32]
|
// CHECK: define void @test_TsBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], [16 x i32]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern fn test_TsBigS(_: TsBigS) -> TsBigS { loop {} }
|
pub extern "C" fn test_TsBigS(_: TsBigS) -> TsBigS {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: define void @test_TuBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], [16 x i32]
|
// CHECK: define void @test_TuBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], [16 x i32]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern fn test_TuBigS(_: TuBigS) -> TuBigS { loop {} }
|
pub extern "C" fn test_TuBigS(_: TuBigS) -> TuBigS {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: define void @test_TeBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], [16 x i32]
|
// CHECK: define void @test_TeBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], [16 x i32]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern fn test_TeBigS(_: TeBigS) -> TeBigS { loop {} }
|
pub extern "C" fn test_TeBigS(_: TeBigS) -> TeBigS {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub union BigU {
|
pub union BigU {
|
||||||
|
@ -88,16 +97,24 @@ pub enum TeBigU {
|
||||||
|
|
||||||
// CHECK: define void @test_BigU(ptr [[BIGU_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], [16 x i32]
|
// CHECK: define void @test_BigU(ptr [[BIGU_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], [16 x i32]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern fn test_BigU(_: BigU) -> BigU { loop {} }
|
pub extern "C" fn test_BigU(_: BigU) -> BigU {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: define void @test_TsBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2]], [16 x i32]
|
// CHECK: define void @test_TsBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2]], [16 x i32]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern fn test_TsBigU(_: TsBigU) -> TsBigU { loop {} }
|
pub extern "C" fn test_TsBigU(_: TsBigU) -> TsBigU {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: define void @test_TuBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2]], [16 x i32]
|
// CHECK: define void @test_TuBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2]], [16 x i32]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern fn test_TuBigU(_: TuBigU) -> TuBigU { loop {} }
|
pub extern "C" fn test_TuBigU(_: TuBigU) -> TuBigU {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: define void @test_TeBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2]], [16 x i32]
|
// CHECK: define void @test_TeBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2]], [16 x i32]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern fn test_TeBigU(_: TeBigU) -> TeBigU { loop {} }
|
pub extern "C" fn test_TeBigU(_: TeBigU) -> TeBigU {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
|
@ -13,9 +13,12 @@
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_core]
|
#![no_core]
|
||||||
|
|
||||||
#[lang="sized"] trait Sized { }
|
#[lang = "sized"]
|
||||||
#[lang="freeze"] trait Freeze { }
|
trait Sized {}
|
||||||
#[lang="copy"] trait Copy { }
|
#[lang = "freeze"]
|
||||||
|
trait Freeze {}
|
||||||
|
#[lang = "copy"]
|
||||||
|
trait Copy {}
|
||||||
|
|
||||||
impl Copy for [u32; 16] {}
|
impl Copy for [u32; 16] {}
|
||||||
impl Copy for BigS {}
|
impl Copy for BigS {}
|
||||||
|
@ -39,20 +42,27 @@ pub enum TeBigS {
|
||||||
|
|
||||||
// CHECK: define void @test_BigS(ptr [[BIGS_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGS_RET_ATTRS2:.*]], [8 x i64]
|
// CHECK: define void @test_BigS(ptr [[BIGS_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGS_RET_ATTRS2:.*]], [8 x i64]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern fn test_BigS(_: BigS) -> BigS { loop {} }
|
pub extern "C" fn test_BigS(_: BigS) -> BigS {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: define void @test_TsBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], [8 x i64]
|
// CHECK: define void @test_TsBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], [8 x i64]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern fn test_TsBigS(_: TsBigS) -> TsBigS { loop {} }
|
pub extern "C" fn test_TsBigS(_: TsBigS) -> TsBigS {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: define void @test_TuBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], [8 x i64]
|
// CHECK: define void @test_TuBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], [8 x i64]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern fn test_TuBigS(_: TuBigS) -> TuBigS { loop {} }
|
pub extern "C" fn test_TuBigS(_: TuBigS) -> TuBigS {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: define void @test_TeBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], [8 x i64]
|
// CHECK: define void @test_TeBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], [8 x i64]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern fn test_TeBigS(_: TeBigS) -> TeBigS { loop {} }
|
pub extern "C" fn test_TeBigS(_: TeBigS) -> TeBigS {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub union BigU {
|
pub union BigU {
|
||||||
|
@ -74,16 +84,24 @@ pub enum TeBigU {
|
||||||
|
|
||||||
// CHECK: define void @test_BigU(ptr [[BIGU_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], [8 x i64]
|
// CHECK: define void @test_BigU(ptr [[BIGU_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], [8 x i64]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern fn test_BigU(_: BigU) -> BigU { loop {} }
|
pub extern "C" fn test_BigU(_: BigU) -> BigU {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: define void @test_TsBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2]], [8 x i64]
|
// CHECK: define void @test_TsBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2]], [8 x i64]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern fn test_TsBigU(_: TsBigU) -> TsBigU { loop {} }
|
pub extern "C" fn test_TsBigU(_: TsBigU) -> TsBigU {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: define void @test_TuBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2]], [8 x i64]
|
// CHECK: define void @test_TuBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2]], [8 x i64]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern fn test_TuBigU(_: TuBigU) -> TuBigU { loop {} }
|
pub extern "C" fn test_TuBigU(_: TuBigU) -> TuBigU {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: define void @test_TeBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2]], [8 x i64]
|
// CHECK: define void @test_TeBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2]], [8 x i64]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern fn test_TeBigU(_: TeBigU) -> TeBigU { loop {} }
|
pub extern "C" fn test_TeBigU(_: TeBigU) -> TeBigU {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
|
@ -8,15 +8,17 @@
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_core]
|
#![no_core]
|
||||||
|
|
||||||
#[lang="sized"] trait Sized { }
|
#[lang = "sized"]
|
||||||
#[lang="freeze"] trait Freeze { }
|
trait Sized {}
|
||||||
#[lang="copy"] trait Copy { }
|
#[lang = "freeze"]
|
||||||
|
trait Freeze {}
|
||||||
|
#[lang = "copy"]
|
||||||
|
trait Copy {}
|
||||||
|
|
||||||
impl Copy for [u32; 16] {}
|
impl Copy for [u32; 16] {}
|
||||||
impl Copy for BigS {}
|
impl Copy for BigS {}
|
||||||
impl Copy for BigU {}
|
impl Copy for BigU {}
|
||||||
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct BigS([u32; 16]);
|
pub struct BigS([u32; 16]);
|
||||||
|
|
||||||
|
@ -37,26 +39,33 @@ pub enum TeBigS {
|
||||||
// CHECK-NOT: byval
|
// CHECK-NOT: byval
|
||||||
// CHECK-SAME: %{{[0-9a-z_]+}})
|
// CHECK-SAME: %{{[0-9a-z_]+}})
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_BigS(_: BigS) -> BigS { loop {} }
|
pub extern "C" fn test_BigS(_: BigS) -> BigS {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: define{{.*}}void @test_TsBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr
|
// CHECK: define{{.*}}void @test_TsBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr
|
||||||
// CHECK-NOT: byval
|
// CHECK-NOT: byval
|
||||||
// CHECK-SAME: %{{[0-9a-z_]+}})
|
// CHECK-SAME: %{{[0-9a-z_]+}})
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_TsBigS(_: TsBigS) -> TsBigS { loop {} }
|
pub extern "C" fn test_TsBigS(_: TsBigS) -> TsBigS {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: define{{.*}}void @test_TuBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr
|
// CHECK: define{{.*}}void @test_TuBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr
|
||||||
// CHECK-NOT: byval
|
// CHECK-NOT: byval
|
||||||
// CHECK-SAME: %{{[0-9a-z_]+}})
|
// CHECK-SAME: %{{[0-9a-z_]+}})
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_TuBigS(_: TuBigS) -> TuBigS { loop {} }
|
pub extern "C" fn test_TuBigS(_: TuBigS) -> TuBigS {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: define{{.*}}void @test_TeBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr
|
// CHECK: define{{.*}}void @test_TeBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr
|
||||||
// CHECK-NOT: byval
|
// CHECK-NOT: byval
|
||||||
// CHECK-SAME: %{{[0-9a-z_]+}})
|
// CHECK-SAME: %{{[0-9a-z_]+}})
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_TeBigS(_: TeBigS) -> TeBigS { loop {} }
|
pub extern "C" fn test_TeBigS(_: TeBigS) -> TeBigS {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub union BigU {
|
pub union BigU {
|
||||||
|
@ -80,22 +89,30 @@ pub enum TeBigU {
|
||||||
// CHECK-NOT: byval
|
// CHECK-NOT: byval
|
||||||
// CHECK-SAME: %{{[0-9a-z_]+}})
|
// CHECK-SAME: %{{[0-9a-z_]+}})
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_BigU(_: BigU) -> BigU { loop {} }
|
pub extern "C" fn test_BigU(_: BigU) -> BigU {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: define{{.*}}void @test_TsBigU(ptr [[BIGU_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr
|
// CHECK: define{{.*}}void @test_TsBigU(ptr [[BIGU_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr
|
||||||
// CHECK-NOT: byval
|
// CHECK-NOT: byval
|
||||||
// CHECK-SAME: %{{[0-9a-z_]+}})
|
// CHECK-SAME: %{{[0-9a-z_]+}})
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_TsBigU(_: TsBigU) -> TsBigU { loop {} }
|
pub extern "C" fn test_TsBigU(_: TsBigU) -> TsBigU {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: define{{.*}}void @test_TuBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr
|
// CHECK: define{{.*}}void @test_TuBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr
|
||||||
// CHECK-NOT: byval
|
// CHECK-NOT: byval
|
||||||
// CHECK-SAME: %{{[0-9a-z_]+}})
|
// CHECK-SAME: %{{[0-9a-z_]+}})
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_TuBigU(_: TuBigU) -> TuBigU { loop {} }
|
pub extern "C" fn test_TuBigU(_: TuBigU) -> TuBigU {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: define{{.*}}void @test_TeBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr
|
// CHECK: define{{.*}}void @test_TeBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr
|
||||||
// CHECK-NOT: byval
|
// CHECK-NOT: byval
|
||||||
// CHECK-SAME: %{{[0-9a-z_]+}})
|
// CHECK-SAME: %{{[0-9a-z_]+}})
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_TeBigU(_: TeBigU) -> TeBigU { loop {} }
|
pub extern "C" fn test_TeBigU(_: TeBigU) -> TeBigU {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
|
@ -22,15 +22,17 @@
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_core]
|
#![no_core]
|
||||||
|
|
||||||
#[lang="sized"] trait Sized { }
|
#[lang = "sized"]
|
||||||
#[lang="freeze"] trait Freeze { }
|
trait Sized {}
|
||||||
#[lang="copy"] trait Copy { }
|
#[lang = "freeze"]
|
||||||
|
trait Freeze {}
|
||||||
|
#[lang = "copy"]
|
||||||
|
trait Copy {}
|
||||||
|
|
||||||
impl Copy for [u32; 16] {}
|
impl Copy for [u32; 16] {}
|
||||||
impl Copy for BigS {}
|
impl Copy for BigS {}
|
||||||
impl Copy for BigU {}
|
impl Copy for BigU {}
|
||||||
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct BigS([u32; 16]);
|
pub struct BigS([u32; 16]);
|
||||||
|
|
||||||
|
@ -49,20 +51,27 @@ pub enum TeBigS {
|
||||||
|
|
||||||
// CHECK: define{{.*}}void @test_BigS(ptr [[BIGS_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGS_RET_ATTRS2:.*]], ptr [[BIGS_ARG_ATTRS1:.*]] byval([64 x i8]) [[BIGS_ARG_ATTRS2:.*]])
|
// CHECK: define{{.*}}void @test_BigS(ptr [[BIGS_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGS_RET_ATTRS2:.*]], ptr [[BIGS_ARG_ATTRS1:.*]] byval([64 x i8]) [[BIGS_ARG_ATTRS2:.*]])
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_BigS(_: BigS) -> BigS { loop {} }
|
pub extern "C" fn test_BigS(_: BigS) -> BigS {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: define{{.*}}void @test_TsBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr [[BIGS_ARG_ATTRS1]] byval([64 x i8]) [[BIGS_ARG_ATTRS2:.*]])
|
// CHECK: define{{.*}}void @test_TsBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr [[BIGS_ARG_ATTRS1]] byval([64 x i8]) [[BIGS_ARG_ATTRS2:.*]])
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_TsBigS(_: TsBigS) -> TsBigS { loop {} }
|
pub extern "C" fn test_TsBigS(_: TsBigS) -> TsBigS {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: define{{.*}}void @test_TuBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr [[BIGS_ARG_ATTRS1]] byval([64 x i8]) [[BIGS_ARG_ATTRS2:.*]])
|
// CHECK: define{{.*}}void @test_TuBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr [[BIGS_ARG_ATTRS1]] byval([64 x i8]) [[BIGS_ARG_ATTRS2:.*]])
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_TuBigS(_: TuBigS) -> TuBigS { loop {} }
|
pub extern "C" fn test_TuBigS(_: TuBigS) -> TuBigS {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: define{{.*}}void @test_TeBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr [[BIGS_ARG_ATTRS1]] byval([64 x i8]) [[BIGS_ARG_ATTRS2]])
|
// CHECK: define{{.*}}void @test_TeBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr [[BIGS_ARG_ATTRS1]] byval([64 x i8]) [[BIGS_ARG_ATTRS2]])
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_TeBigS(_: TeBigS) -> TeBigS { loop {} }
|
pub extern "C" fn test_TeBigS(_: TeBigS) -> TeBigS {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub union BigU {
|
pub union BigU {
|
||||||
|
@ -84,16 +93,24 @@ pub enum TeBigU {
|
||||||
|
|
||||||
// CHECK: define{{.*}}void @test_BigU(ptr [[BIGU_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr [[BIGU_ARG_ATTRS1:.*]] byval([64 x i8]) [[BIGU_ARG_ATTRS2:.*]])
|
// CHECK: define{{.*}}void @test_BigU(ptr [[BIGU_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr [[BIGU_ARG_ATTRS1:.*]] byval([64 x i8]) [[BIGU_ARG_ATTRS2:.*]])
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_BigU(_: BigU) -> BigU { loop {} }
|
pub extern "C" fn test_BigU(_: BigU) -> BigU {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: define{{.*}}void @test_TsBigU(ptr [[BIGU_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr [[BIGU_ARG_ATTRS1]] byval([64 x i8]) [[BIGU_ARG_ATTRS2]])
|
// CHECK: define{{.*}}void @test_TsBigU(ptr [[BIGU_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr [[BIGU_ARG_ATTRS1]] byval([64 x i8]) [[BIGU_ARG_ATTRS2]])
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_TsBigU(_: TsBigU) -> TsBigU { loop {} }
|
pub extern "C" fn test_TsBigU(_: TsBigU) -> TsBigU {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: define{{.*}}void @test_TuBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr [[BIGU_ARG_ATTRS1]] byval([64 x i8]) [[BIGU_ARG_ATTRS2]])
|
// CHECK: define{{.*}}void @test_TuBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr [[BIGU_ARG_ATTRS1]] byval([64 x i8]) [[BIGU_ARG_ATTRS2]])
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_TuBigU(_: TuBigU) -> TuBigU { loop {} }
|
pub extern "C" fn test_TuBigU(_: TuBigU) -> TuBigU {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: define{{.*}}void @test_TeBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr [[BIGU_ARG_ATTRS1]] byval([64 x i8]) [[BIGU_ARG_ATTRS2]])
|
// CHECK: define{{.*}}void @test_TeBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr [[BIGU_ARG_ATTRS1]] byval([64 x i8]) [[BIGU_ARG_ATTRS2]])
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_TeBigU(_: TeBigU) -> TeBigU { loop {} }
|
pub extern "C" fn test_TeBigU(_: TeBigU) -> TeBigU {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
|
@ -13,19 +13,28 @@
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_core]
|
#![no_core]
|
||||||
|
|
||||||
#[lang="sized"] trait Sized { }
|
#[lang = "sized"]
|
||||||
#[lang="freeze"] trait Freeze { }
|
trait Sized {}
|
||||||
#[lang="copy"] trait Copy { }
|
#[lang = "freeze"]
|
||||||
|
trait Freeze {}
|
||||||
|
#[lang = "copy"]
|
||||||
|
trait Copy {}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct Rgb8 { r: u8, g: u8, b: u8 }
|
pub struct Rgb8 {
|
||||||
|
r: u8,
|
||||||
|
g: u8,
|
||||||
|
b: u8,
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct Rgb8Wrap(Rgb8);
|
pub struct Rgb8Wrap(Rgb8);
|
||||||
|
|
||||||
// CHECK: i24 @test_Rgb8Wrap(i24{{( %0)?}})
|
// CHECK: i24 @test_Rgb8Wrap(i24{{( %0)?}})
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "sysv64" fn test_Rgb8Wrap(_: Rgb8Wrap) -> Rgb8Wrap { loop {} }
|
pub extern "sysv64" fn test_Rgb8Wrap(_: Rgb8Wrap) -> Rgb8Wrap {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub union FloatBits {
|
pub union FloatBits {
|
||||||
|
@ -38,4 +47,6 @@ pub struct SmallUnion(FloatBits);
|
||||||
|
|
||||||
// CHECK: i32 @test_SmallUnion(i32{{( %0)?}})
|
// CHECK: i32 @test_SmallUnion(i32{{( %0)?}})
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "sysv64" fn test_SmallUnion(_: SmallUnion) -> SmallUnion { loop {} }
|
pub extern "sysv64" fn test_SmallUnion(_: SmallUnion) -> SmallUnion {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
|
@ -24,83 +24,112 @@ pub struct F32(f32);
|
||||||
|
|
||||||
// CHECK: define{{.*}}float @test_F32(float noundef %_1)
|
// CHECK: define{{.*}}float @test_F32(float noundef %_1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_F32(_: F32) -> F32 { loop {} }
|
pub extern "C" fn test_F32(_: F32) -> F32 {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct Ptr(*mut u8);
|
pub struct Ptr(*mut u8);
|
||||||
|
|
||||||
// CHECK: define{{.*}}ptr @test_Ptr(ptr noundef %_1)
|
// CHECK: define{{.*}}ptr @test_Ptr(ptr noundef %_1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_Ptr(_: Ptr) -> Ptr { loop {} }
|
pub extern "C" fn test_Ptr(_: Ptr) -> Ptr {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct WithZst(u64, Zst1);
|
pub struct WithZst(u64, Zst1);
|
||||||
|
|
||||||
// CHECK: define{{.*}}i64 @test_WithZst(i64 noundef %_1)
|
// CHECK: define{{.*}}i64 @test_WithZst(i64 noundef %_1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_WithZst(_: WithZst) -> WithZst { loop {} }
|
pub extern "C" fn test_WithZst(_: WithZst) -> WithZst {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct WithZeroSizedArray(*const f32, [i8; 0]);
|
pub struct WithZeroSizedArray(*const f32, [i8; 0]);
|
||||||
|
|
||||||
// CHECK: define{{.*}}ptr @test_WithZeroSizedArray(ptr noundef %_1)
|
// CHECK: define{{.*}}ptr @test_WithZeroSizedArray(ptr noundef %_1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_WithZeroSizedArray(_: WithZeroSizedArray) -> WithZeroSizedArray { loop {} }
|
pub extern "C" fn test_WithZeroSizedArray(_: WithZeroSizedArray) -> WithZeroSizedArray {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct Generic<T>(T);
|
pub struct Generic<T>(T);
|
||||||
|
|
||||||
// CHECK: define{{.*}}double @test_Generic(double noundef %_1)
|
// CHECK: define{{.*}}double @test_Generic(double noundef %_1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_Generic(_: Generic<f64>) -> Generic<f64> { loop {} }
|
pub extern "C" fn test_Generic(_: Generic<f64>) -> Generic<f64> {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct GenericPlusZst<T>(T, Zst2);
|
pub struct GenericPlusZst<T>(T, Zst2);
|
||||||
|
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
pub enum Bool { True, False, FileNotFound }
|
pub enum Bool {
|
||||||
|
True,
|
||||||
|
False,
|
||||||
|
FileNotFound,
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK: define{{( dso_local)?}} noundef{{( zeroext)?}} i8 @test_Gpz(i8 noundef{{( zeroext)?}} %_1)
|
// CHECK: define{{( dso_local)?}} noundef{{( zeroext)?}} i8 @test_Gpz(i8 noundef{{( zeroext)?}} %_1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_Gpz(_: GenericPlusZst<Bool>) -> GenericPlusZst<Bool> { loop {} }
|
pub extern "C" fn test_Gpz(_: GenericPlusZst<Bool>) -> GenericPlusZst<Bool> {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct LifetimePhantom<'a, T: 'a>(*const T, PhantomData<&'a T>);
|
pub struct LifetimePhantom<'a, T: 'a>(*const T, PhantomData<&'a T>);
|
||||||
|
|
||||||
// CHECK: define{{.*}}ptr @test_LifetimePhantom(ptr noundef %_1)
|
// CHECK: define{{.*}}ptr @test_LifetimePhantom(ptr noundef %_1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_LifetimePhantom(_: LifetimePhantom<i16>) -> LifetimePhantom<i16> { loop {} }
|
pub extern "C" fn test_LifetimePhantom(_: LifetimePhantom<i16>) -> LifetimePhantom<i16> {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
// This works despite current alignment resrictions because PhantomData is always align(1)
|
// This works despite current alignment resrictions because PhantomData is always align(1)
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct UnitPhantom<T, U> { val: T, unit: PhantomData<U> }
|
pub struct UnitPhantom<T, U> {
|
||||||
|
val: T,
|
||||||
|
unit: PhantomData<U>,
|
||||||
|
}
|
||||||
|
|
||||||
pub struct Px;
|
pub struct Px;
|
||||||
|
|
||||||
// CHECK: define{{.*}}float @test_UnitPhantom(float noundef %_1)
|
// CHECK: define{{.*}}float @test_UnitPhantom(float noundef %_1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_UnitPhantom(_: UnitPhantom<f32, Px>) -> UnitPhantom<f32, Px> { loop {} }
|
pub extern "C" fn test_UnitPhantom(_: UnitPhantom<f32, Px>) -> UnitPhantom<f32, Px> {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct TwoZsts(Zst1, i8, Zst2);
|
pub struct TwoZsts(Zst1, i8, Zst2);
|
||||||
|
|
||||||
// CHECK: define{{( dso_local)?}} noundef{{( signext)?}} i8 @test_TwoZsts(i8 noundef{{( signext)?}} %_1)
|
// CHECK: define{{( dso_local)?}} noundef{{( signext)?}} i8 @test_TwoZsts(i8 noundef{{( signext)?}} %_1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_TwoZsts(_: TwoZsts) -> TwoZsts { loop {} }
|
pub extern "C" fn test_TwoZsts(_: TwoZsts) -> TwoZsts {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct Nested1(Zst2, Generic<f64>);
|
pub struct Nested1(Zst2, Generic<f64>);
|
||||||
|
|
||||||
// CHECK: define{{.*}}double @test_Nested1(double noundef %_1)
|
// CHECK: define{{.*}}double @test_Nested1(double noundef %_1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_Nested1(_: Nested1) -> Nested1 { loop {} }
|
pub extern "C" fn test_Nested1(_: Nested1) -> Nested1 {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct Nested2(Nested1, Zst1);
|
pub struct Nested2(Nested1, Zst1);
|
||||||
|
|
||||||
// CHECK: define{{.*}}double @test_Nested2(double noundef %_1)
|
// CHECK: define{{.*}}double @test_Nested2(double noundef %_1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_Nested2(_: Nested2) -> Nested2 { loop {} }
|
pub extern "C" fn test_Nested2(_: Nested2) -> Nested2 {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(simd)]
|
#[repr(simd)]
|
||||||
struct f32x4(f32, f32, f32, f32);
|
struct f32x4(f32, f32, f32, f32);
|
||||||
|
@ -110,35 +139,47 @@ pub struct Vector(f32x4);
|
||||||
|
|
||||||
// CHECK: define{{.*}}<4 x float> @test_Vector(<4 x float> %_1)
|
// CHECK: define{{.*}}<4 x float> @test_Vector(<4 x float> %_1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_Vector(_: Vector) -> Vector { loop {} }
|
pub extern "C" fn test_Vector(_: Vector) -> Vector {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
trait Mirror { type It: ?Sized; }
|
trait Mirror {
|
||||||
impl<T: ?Sized> Mirror for T { type It = Self; }
|
type It: ?Sized;
|
||||||
|
}
|
||||||
|
impl<T: ?Sized> Mirror for T {
|
||||||
|
type It = Self;
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct StructWithProjection(<f32 as Mirror>::It);
|
pub struct StructWithProjection(<f32 as Mirror>::It);
|
||||||
|
|
||||||
// CHECK: define{{.*}}float @test_Projection(float noundef %_1)
|
// CHECK: define{{.*}}float @test_Projection(float noundef %_1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_Projection(_: StructWithProjection) -> StructWithProjection { loop {} }
|
pub extern "C" fn test_Projection(_: StructWithProjection) -> StructWithProjection {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub enum EnumF32 {
|
pub enum EnumF32 {
|
||||||
Variant(F32)
|
Variant(F32),
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK: define{{.*}}float @test_EnumF32(float noundef %_1)
|
// CHECK: define{{.*}}float @test_EnumF32(float noundef %_1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_EnumF32(_: EnumF32) -> EnumF32 { loop {} }
|
pub extern "C" fn test_EnumF32(_: EnumF32) -> EnumF32 {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub enum EnumF32WithZsts {
|
pub enum EnumF32WithZsts {
|
||||||
Variant(Zst1, F32, Zst2)
|
Variant(Zst1, F32, Zst2),
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK: define{{.*}}float @test_EnumF32WithZsts(float noundef %_1)
|
// CHECK: define{{.*}}float @test_EnumF32WithZsts(float noundef %_1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_EnumF32WithZsts(_: EnumF32WithZsts) -> EnumF32WithZsts { loop {} }
|
pub extern "C" fn test_EnumF32WithZsts(_: EnumF32WithZsts) -> EnumF32WithZsts {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub union UnionF32 {
|
pub union UnionF32 {
|
||||||
|
@ -147,7 +188,9 @@ pub union UnionF32 {
|
||||||
|
|
||||||
// CHECK: define{{.*}} float @test_UnionF32(float %_1)
|
// CHECK: define{{.*}} float @test_UnionF32(float %_1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_UnionF32(_: UnionF32) -> UnionF32 { loop {} }
|
pub extern "C" fn test_UnionF32(_: UnionF32) -> UnionF32 {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub union UnionF32WithZsts {
|
pub union UnionF32WithZsts {
|
||||||
|
@ -158,8 +201,9 @@ pub union UnionF32WithZsts {
|
||||||
|
|
||||||
// CHECK: define{{.*}}float @test_UnionF32WithZsts(float %_1)
|
// CHECK: define{{.*}}float @test_UnionF32WithZsts(float %_1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn test_UnionF32WithZsts(_: UnionF32WithZsts) -> UnionF32WithZsts { loop {} }
|
pub extern "C" fn test_UnionF32WithZsts(_: UnionF32WithZsts) -> UnionF32WithZsts {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
// All that remains to be tested are aggregates. They are tested in separate files called
|
// All that remains to be tested are aggregates. They are tested in separate files called
|
||||||
// transparent-*.rs with `only-*` or `ignore-*` directives, because the expected LLVM IR
|
// transparent-*.rs with `only-*` or `ignore-*` directives, because the expected LLVM IR
|
||||||
|
|
|
@ -83,8 +83,7 @@ pub struct Tiny {
|
||||||
|
|
||||||
// CHECK: define void @f_agg_tiny(i64 %0)
|
// CHECK: define void @f_agg_tiny(i64 %0)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn f_agg_tiny(mut e: Tiny) {
|
pub extern "C" fn f_agg_tiny(mut e: Tiny) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: define i64 @f_agg_tiny_ret()
|
// CHECK: define i64 @f_agg_tiny_ret()
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
@ -100,8 +99,7 @@ pub struct Small {
|
||||||
|
|
||||||
// CHECK: define void @f_agg_small([2 x i64] %0)
|
// CHECK: define void @f_agg_small([2 x i64] %0)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn f_agg_small(mut x: Small) {
|
pub extern "C" fn f_agg_small(mut x: Small) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: define [2 x i64] @f_agg_small_ret()
|
// CHECK: define [2 x i64] @f_agg_small_ret()
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
@ -116,8 +114,7 @@ pub struct SmallAligned {
|
||||||
|
|
||||||
// CHECK: define void @f_agg_small_aligned(i128 %0)
|
// CHECK: define void @f_agg_small_aligned(i128 %0)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn f_agg_small_aligned(mut x: SmallAligned) {
|
pub extern "C" fn f_agg_small_aligned(mut x: SmallAligned) {}
|
||||||
}
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct Large {
|
pub struct Large {
|
||||||
|
@ -129,8 +126,7 @@ pub struct Large {
|
||||||
|
|
||||||
// CHECK: define void @f_agg_large(ptr {{.*}}%x)
|
// CHECK: define void @f_agg_large(ptr {{.*}}%x)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn f_agg_large(mut x: Large) {
|
pub extern "C" fn f_agg_large(mut x: Large) {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: define void @f_agg_large_ret(ptr {{.*}}sret{{.*}}, i32 noundef signext %i, i8 noundef signext %j)
|
// CHECK: define void @f_agg_large_ret(ptr {{.*}}sret{{.*}}, i32 noundef signext %i, i8 noundef signext %j)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
pub fn foo() {
|
pub fn foo() {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: !{{[0-9]+}} = !{i32 4, !"CFI Canonical Jump Tables", i32 1}
|
// CHECK: !{{[0-9]+}} = !{i32 4, !"CFI Canonical Jump Tables", i32 1}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
pub fn foo() {
|
pub fn foo() {}
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK: !{{[0-9]+}} = !{i32 4, !"EnableSplitLTOUnit", i32 1}
|
// CHECK: !{{[0-9]+}} = !{i32 4, !"EnableSplitLTOUnit", i32 1}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#[cfi_encoding = "3Foo"]
|
#[cfi_encoding = "3Foo"]
|
||||||
pub struct Type1(i32);
|
pub struct Type1(i32);
|
||||||
|
|
||||||
extern {
|
extern "C" {
|
||||||
#[cfi_encoding = "3Bar"]
|
#[cfi_encoding = "3Bar"]
|
||||||
type Type2;
|
type Type2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,8 @@ extern crate core;
|
||||||
|
|
||||||
pub type Type1 = impl Send;
|
pub type Type1 = impl Send;
|
||||||
|
|
||||||
pub fn foo() where
|
pub fn foo()
|
||||||
|
where
|
||||||
Type1: 'static,
|
Type1: 'static,
|
||||||
{
|
{
|
||||||
pub struct Foo<T, const N: usize>([T; N]);
|
pub struct Foo<T, const N: usize>([T; N]);
|
||||||
|
|
|
@ -11,7 +11,8 @@ extern crate core;
|
||||||
|
|
||||||
pub type Type1 = impl Send;
|
pub type Type1 = impl Send;
|
||||||
|
|
||||||
pub fn foo<'a>() where
|
pub fn foo<'a>()
|
||||||
|
where
|
||||||
Type1: 'static,
|
Type1: 'static,
|
||||||
{
|
{
|
||||||
pub struct Foo<'a>(&'a i32);
|
pub struct Foo<'a>(&'a i32);
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue