mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
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
@ -14,7 +14,7 @@ ignore = [
|
||||
# - some contain syntax errors that cause rustfmt to give an error
|
||||
# - some UI tests are broken by different formatting
|
||||
# - 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/coverage/",
|
||||
"/tests/coverage-run-rustdoc/",
|
||||
|
@ -12,14 +12,12 @@
|
||||
#![crate_type = "lib"]
|
||||
#![no_core]
|
||||
|
||||
#[lang="sized"]
|
||||
trait Sized { }
|
||||
#[lang="freeze"]
|
||||
trait Freeze { }
|
||||
#[lang="copy"]
|
||||
trait Copy { }
|
||||
|
||||
|
||||
#[lang = "sized"]
|
||||
trait Sized {}
|
||||
#[lang = "freeze"]
|
||||
trait Freeze {}
|
||||
#[lang = "copy"]
|
||||
trait Copy {}
|
||||
|
||||
// Passed as `[i64 x 2]`, since it's an aggregate with size <= 128 bits, align < 128 bits.
|
||||
#[repr(C)]
|
||||
@ -31,7 +29,7 @@ pub struct Align8 {
|
||||
// repr(transparent), so same as above.
|
||||
#[repr(transparent)]
|
||||
pub struct Transparent8 {
|
||||
a: Align8
|
||||
a: Align8,
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 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,
|
||||
// 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)]
|
||||
pub struct Transparent16 {
|
||||
a: Align16
|
||||
a: Align16,
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Passed as `i128`, since it's an aggregate with size <= 128 bits, align = 128 bits.
|
||||
#[repr(C)]
|
||||
pub struct I128 {
|
||||
@ -90,13 +84,13 @@ pub struct I128 {
|
||||
// repr(transparent), so same as above.
|
||||
#[repr(transparent)]
|
||||
pub struct TransparentI128 {
|
||||
a: I128
|
||||
a: I128,
|
||||
}
|
||||
|
||||
// Passed as `i128`, since it's an aggregate with size <= 128 bits, align = 128 bits.
|
||||
#[repr(C)]
|
||||
pub struct WrappedI128 {
|
||||
pub a: I128
|
||||
pub a: I128,
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
@ -106,8 +100,6 @@ extern "C" {
|
||||
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.
|
||||
// Note that the Linux special case does not apply, because packing is not considered "adjustment".
|
||||
#[repr(C)]
|
||||
@ -119,13 +111,13 @@ pub struct Packed {
|
||||
// repr(transparent), so same as above.
|
||||
#[repr(transparent)]
|
||||
pub struct TransparentPacked {
|
||||
a: Packed
|
||||
a: Packed,
|
||||
}
|
||||
|
||||
// Passed as `[2 x i64]`, since it's an aggregate with size <= 128 bits, align < 128 bits.
|
||||
#[repr(C)]
|
||||
pub struct WrappedPacked {
|
||||
pub a: Packed
|
||||
pub a: Packed,
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
@ -135,13 +127,19 @@ extern "C" {
|
||||
fn test_packed(a: Packed, b: TransparentPacked, c: WrappedPacked);
|
||||
}
|
||||
|
||||
|
||||
|
||||
pub unsafe fn main(
|
||||
a1: Align8, a2: Transparent8, a3: Wrapped8,
|
||||
b1: Align16, b2: Transparent16, b3: Wrapped16,
|
||||
c1: I128, c2: TransparentI128, c3: WrappedI128,
|
||||
d1: Packed, d2: TransparentPacked, d3: WrappedPacked,
|
||||
a1: Align8,
|
||||
a2: Transparent8,
|
||||
a3: Wrapped8,
|
||||
b1: Align16,
|
||||
b2: Transparent16,
|
||||
b3: Wrapped16,
|
||||
c1: I128,
|
||||
c2: TransparentI128,
|
||||
c3: WrappedI128,
|
||||
d1: Packed,
|
||||
d2: TransparentPacked,
|
||||
d3: WrappedPacked,
|
||||
) {
|
||||
test_8(a1, a2, a3);
|
||||
test_16(b1, b2, b3);
|
||||
|
@ -17,12 +17,12 @@
|
||||
#![feature(no_core, lang_items)]
|
||||
#![no_core]
|
||||
|
||||
#[lang="sized"]
|
||||
trait Sized { }
|
||||
#[lang="freeze"]
|
||||
trait Freeze { }
|
||||
#[lang="copy"]
|
||||
trait Copy { }
|
||||
#[lang = "sized"]
|
||||
trait Sized {}
|
||||
#[lang = "freeze"]
|
||||
trait Freeze {}
|
||||
#[lang = "copy"]
|
||||
trait Copy {}
|
||||
|
||||
//x86_64: define win64cc void @has_efiapi
|
||||
//i686: define void @has_efiapi
|
||||
|
@ -6,8 +6,6 @@
|
||||
//@[avr] only-avr
|
||||
//@[msp] only-msp430
|
||||
|
||||
|
||||
fn main() {
|
||||
}
|
||||
fn main() {}
|
||||
|
||||
// CHECK: define i16 @main(i16, i8**)
|
||||
|
@ -6,7 +6,6 @@
|
||||
//@ ignore-avr
|
||||
//@ ignore-wasi wasi codegens the main symbol differently
|
||||
|
||||
fn main() {
|
||||
}
|
||||
fn main() {}
|
||||
|
||||
// CHECK: define{{( hidden| noundef)*}} i32 @main(i32{{( %0)?}}, ptr{{( %1)?}})
|
||||
|
@ -24,14 +24,17 @@
|
||||
#![no_std]
|
||||
#![no_core]
|
||||
|
||||
#[lang="sized"] trait Sized { }
|
||||
#[lang="freeze"] trait Freeze { }
|
||||
#[lang="copy"] trait Copy { }
|
||||
#[lang = "sized"]
|
||||
trait Sized {}
|
||||
#[lang = "freeze"]
|
||||
trait Freeze {}
|
||||
#[lang = "copy"]
|
||||
trait Copy {}
|
||||
|
||||
#[repr(i8)]
|
||||
pub enum Type {
|
||||
Type1 = 0,
|
||||
Type2 = 1
|
||||
Type2 = 1,
|
||||
}
|
||||
|
||||
// To accommodate rust#97800, one might consider writing the below as:
|
||||
@ -50,7 +53,6 @@ pub enum Type {
|
||||
// riscv-SAME: signext
|
||||
// CHECK-SAME: i8 @test()
|
||||
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn test() -> Type {
|
||||
Type::Type1
|
||||
|
@ -5,17 +5,16 @@
|
||||
// Hack to get the correct size for the length part in slices
|
||||
// CHECK: @helper([[USIZE:i[0-9]+]] %_1)
|
||||
#[no_mangle]
|
||||
pub fn helper(_: usize) {
|
||||
}
|
||||
pub fn helper(_: usize) {}
|
||||
|
||||
// CHECK-LABEL: @no_op_slice_adjustment
|
||||
#[no_mangle]
|
||||
pub fn no_op_slice_adjustment(x: &[u8]) -> &[u8] {
|
||||
// We used to generate an extra alloca and memcpy for the block's trailing expression value, so
|
||||
// check that we copy directly to the return value slot
|
||||
// CHECK: %0 = insertvalue { ptr, [[USIZE]] } poison, ptr %x.0, 0
|
||||
// CHECK: %1 = insertvalue { ptr, [[USIZE]] } %0, [[USIZE]] %x.1, 1
|
||||
// CHECK: ret { ptr, [[USIZE]] } %1
|
||||
// CHECK: %0 = insertvalue { ptr, [[USIZE]] } poison, ptr %x.0, 0
|
||||
// CHECK: %1 = insertvalue { ptr, [[USIZE]] } %0, [[USIZE]] %x.1, 1
|
||||
// CHECK: ret { ptr, [[USIZE]] } %1
|
||||
{ x }
|
||||
}
|
||||
|
||||
@ -24,6 +23,6 @@ pub fn no_op_slice_adjustment(x: &[u8]) -> &[u8] {
|
||||
pub fn no_op_slice_adjustment2(x: &[u8]) -> &[u8] {
|
||||
// We used to generate an extra alloca and memcpy for the function's return value, so check
|
||||
// that there's no memcpy (the slice is written to sret_slot element-wise)
|
||||
// CHECK-NOT: call void @llvm.memcpy.
|
||||
// CHECK-NOT: call void @llvm.memcpy.
|
||||
no_op_slice_adjustment(x)
|
||||
}
|
||||
|
@ -23,9 +23,12 @@
|
||||
#![no_std]
|
||||
#![no_core]
|
||||
|
||||
#[lang="sized"] trait Sized { }
|
||||
#[lang="freeze"] trait Freeze { }
|
||||
#[lang="copy"] trait Copy { }
|
||||
#[lang = "sized"]
|
||||
trait Sized {}
|
||||
#[lang = "freeze"]
|
||||
trait Freeze {}
|
||||
#[lang = "copy"]
|
||||
trait Copy {}
|
||||
|
||||
impl Copy for i32 {}
|
||||
impl Copy for i64 {}
|
||||
@ -58,7 +61,7 @@ pub struct ForceAlign4 {
|
||||
pub struct NaturalAlign8 {
|
||||
a: i64,
|
||||
b: i64,
|
||||
c: i64
|
||||
c: i64,
|
||||
}
|
||||
|
||||
// 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 {
|
||||
a: i64,
|
||||
b: i64,
|
||||
c: i64
|
||||
c: i64,
|
||||
}
|
||||
|
||||
// On i686-windows, this is passed on stack, because requested alignment is <=4.
|
||||
@ -77,28 +80,28 @@ pub struct ForceAlign8 {
|
||||
pub struct LowerFA8 {
|
||||
a: i64,
|
||||
b: i64,
|
||||
c: i64
|
||||
c: i64,
|
||||
}
|
||||
|
||||
// On i686-windows, this is passed by reference, because it contains a field with
|
||||
// requested/forced alignment.
|
||||
#[repr(C)]
|
||||
pub struct WrappedFA8 {
|
||||
a: ForceAlign8
|
||||
a: ForceAlign8,
|
||||
}
|
||||
|
||||
// On i686-windows, this has the same ABI as ForceAlign8, i.e. passed by reference.
|
||||
#[repr(transparent)]
|
||||
pub struct TransparentFA8 {
|
||||
_0: (),
|
||||
a: ForceAlign8
|
||||
a: ForceAlign8,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[repr(align(16))]
|
||||
pub struct ForceAlign16 {
|
||||
a: [i32; 16],
|
||||
b: i8
|
||||
b: i8,
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @call_na1
|
||||
|
@ -18,8 +18,8 @@ pub struct Nested64 {
|
||||
// CHECK-LABEL: @align64
|
||||
#[no_mangle]
|
||||
pub fn align64(a: u32) -> Align64 {
|
||||
// CHECK: %a64 = alloca [64 x i8], align 64
|
||||
// CHECK: call void @llvm.memcpy.{{.*}}(ptr align 64 %{{.*}}, ptr align 64 %{{.*}}, i{{[0-9]+}} 64, i1 false)
|
||||
// CHECK: %a64 = alloca [64 x i8], align 64
|
||||
// CHECK: call void @llvm.memcpy.{{.*}}(ptr align 64 %{{.*}}, ptr align 64 %{{.*}}, i{{[0-9]+}} 64, i1 false)
|
||||
let a64 = Align64::A(a);
|
||||
a64
|
||||
}
|
||||
@ -27,7 +27,7 @@ pub fn align64(a: u32) -> Align64 {
|
||||
// CHECK-LABEL: @nested64
|
||||
#[no_mangle]
|
||||
pub fn nested64(a: u8, b: u32, c: u16) -> Nested64 {
|
||||
// CHECK: %n64 = alloca [128 x i8], align 64
|
||||
// CHECK: %n64 = alloca [128 x i8], align 64
|
||||
let n64 = Nested64 { a, b: Align64::B(b), c };
|
||||
n64
|
||||
}
|
||||
|
@ -53,7 +53,6 @@ pub fn align_offset_word_slice(slice: &[Align4]) -> usize {
|
||||
slice.as_ptr().align_offset(32)
|
||||
}
|
||||
|
||||
|
||||
// CHECK-LABEL: @align_offset_word_ptr(ptr{{.+}}%ptr
|
||||
#[no_mangle]
|
||||
pub fn align_offset_word_ptr(ptr: *const Align4) -> usize {
|
||||
|
@ -25,9 +25,9 @@ pub enum Enum64 {
|
||||
|
||||
// CHECK-LABEL: @align64
|
||||
#[no_mangle]
|
||||
pub fn align64(i : i32) -> Align64 {
|
||||
// CHECK: %a64 = alloca [64 x i8], align 64
|
||||
// CHECK: call void @llvm.memcpy.{{.*}}(ptr align 64 %{{.*}}, ptr align 64 %{{.*}}, i{{[0-9]+}} 64, i1 false)
|
||||
pub fn align64(i: i32) -> Align64 {
|
||||
// CHECK: %a64 = alloca [64 x i8], align 64
|
||||
// CHECK: call void @llvm.memcpy.{{.*}}(ptr align 64 %{{.*}}, ptr align 64 %{{.*}}, i{{[0-9]+}} 64, i1 false)
|
||||
let a64 = Align64(i);
|
||||
a64
|
||||
}
|
||||
@ -37,14 +37,14 @@ pub fn align64(i : i32) -> Align64 {
|
||||
// CHECK-LABEL: @align64_load
|
||||
#[no_mangle]
|
||||
pub fn align64_load(a: Align64) -> i32 {
|
||||
// CHECK: {{%.*}} = load i32, ptr {{%.*}}, align 64
|
||||
// CHECK: {{%.*}} = load i32, ptr {{%.*}}, align 64
|
||||
a.0
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @nested64
|
||||
#[no_mangle]
|
||||
pub fn nested64(a: Align64, b: i32, c: i32, d: i8) -> Nested64 {
|
||||
// CHECK: %n64 = alloca [128 x i8], align 64
|
||||
// CHECK: %n64 = alloca [128 x i8], align 64
|
||||
let n64 = Nested64 { a, b, c, d };
|
||||
n64
|
||||
}
|
||||
@ -52,7 +52,7 @@ pub fn nested64(a: Align64, b: i32, c: i32, d: i8) -> Nested64 {
|
||||
// CHECK-LABEL: @enum4
|
||||
#[no_mangle]
|
||||
pub fn enum4(a: i32) -> Enum4 {
|
||||
// CHECK: %e4 = alloca [8 x i8], align 4
|
||||
// CHECK: %e4 = alloca [8 x i8], align 4
|
||||
let e4 = Enum4::A(a);
|
||||
e4
|
||||
}
|
||||
@ -60,7 +60,7 @@ pub fn enum4(a: i32) -> Enum4 {
|
||||
// CHECK-LABEL: @enum64
|
||||
#[no_mangle]
|
||||
pub fn enum64(a: Align64) -> Enum64 {
|
||||
// CHECK: %e64 = alloca [128 x i8], align 64
|
||||
// CHECK: %e64 = alloca [128 x i8], align 64
|
||||
let e64 = Enum64::A(a);
|
||||
e64
|
||||
}
|
||||
|
@ -10,7 +10,8 @@
|
||||
#[no_mangle]
|
||||
pub fn compare() -> bool {
|
||||
let bytes = 12.5f32.to_ne_bytes();
|
||||
bytes == if cfg!(target_endian = "big") {
|
||||
bytes
|
||||
== if cfg!(target_endian = "big") {
|
||||
[0x41, 0x48, 0x00, 0x00]
|
||||
} else {
|
||||
[0x00, 0x00, 0x48, 0x41]
|
||||
|
@ -4,8 +4,8 @@
|
||||
#![crate_type = "rlib"]
|
||||
#![allow(asm_sub_register)]
|
||||
|
||||
use std::mem::MaybeUninit;
|
||||
use std::arch::asm;
|
||||
use std::mem::MaybeUninit;
|
||||
|
||||
// CHECK-LABEL: @int
|
||||
#[no_mangle]
|
||||
|
@ -21,14 +21,10 @@ trait Copy {}
|
||||
|
||||
pub unsafe fn we_escape_dollar_signs() {
|
||||
// CHECK: call void asm sideeffect alignstack inteldialect "banana$$:"
|
||||
asm!(
|
||||
r"banana$:",
|
||||
)
|
||||
asm!(r"banana$:",)
|
||||
}
|
||||
|
||||
pub unsafe fn we_escape_escapes_too() {
|
||||
// CHECK: call void asm sideeffect alignstack inteldialect "banana\{{(\\|5C)}}36:"
|
||||
asm!(
|
||||
r"banana\36:",
|
||||
)
|
||||
asm!(r"banana\36:",)
|
||||
}
|
||||
|
@ -6,13 +6,12 @@
|
||||
|
||||
//@ compile-flags: -O -Cno-prepopulate-passes
|
||||
#![crate_type = "lib"]
|
||||
|
||||
#![feature(strict_provenance)]
|
||||
#![feature(strict_provenance_atomic_ptr)]
|
||||
|
||||
use std::ptr::without_provenance_mut;
|
||||
use std::sync::atomic::AtomicPtr;
|
||||
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.
|
||||
// CHECK: @helper([[USIZE:i[0-9]+]] noundef %_1)
|
||||
|
@ -5,25 +5,20 @@
|
||||
// CHECK-LABEL: @auto_vectorize_direct
|
||||
#[no_mangle]
|
||||
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: store <4 x float>
|
||||
[
|
||||
a[0] + b[0],
|
||||
a[1] + b[1],
|
||||
a[2] + b[2],
|
||||
a[3] + b[3],
|
||||
]
|
||||
// CHECK: load <4 x float>
|
||||
// CHECK: load <4 x float>
|
||||
// CHECK: fadd <4 x float>
|
||||
// CHECK: store <4 x float>
|
||||
[a[0] + b[0], a[1] + b[1], a[2] + b[2], a[3] + b[3]]
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @auto_vectorize_loop
|
||||
#[no_mangle]
|
||||
pub fn auto_vectorize_loop(a: [f32; 4], b: [f32; 4]) -> [f32; 4] {
|
||||
// CHECK: load <4 x float>
|
||||
// CHECK: load <4 x float>
|
||||
// CHECK: fadd <4 x float>
|
||||
// CHECK: store <4 x float>
|
||||
// CHECK: load <4 x float>
|
||||
// CHECK: load <4 x float>
|
||||
// CHECK: fadd <4 x float>
|
||||
// CHECK: store <4 x float>
|
||||
let mut c = [0.0; 4];
|
||||
for i in 0..4 {
|
||||
c[i] = a[i] + b[i];
|
||||
@ -34,9 +29,9 @@ pub fn auto_vectorize_loop(a: [f32; 4], b: [f32; 4]) -> [f32; 4] {
|
||||
// CHECK-LABEL: @auto_vectorize_array_from_fn
|
||||
#[no_mangle]
|
||||
pub fn auto_vectorize_array_from_fn(a: [f32; 4], b: [f32; 4]) -> [f32; 4] {
|
||||
// CHECK: load <4 x float>
|
||||
// CHECK: load <4 x float>
|
||||
// CHECK: fadd <4 x float>
|
||||
// CHECK: store <4 x float>
|
||||
// CHECK: load <4 x float>
|
||||
// CHECK: load <4 x float>
|
||||
// CHECK: fadd <4 x float>
|
||||
// CHECK: store <4 x float>
|
||||
std::array::from_fn(|i| a[i] + b[i])
|
||||
}
|
||||
|
@ -5,7 +5,9 @@
|
||||
#![crate_type = "lib"]
|
||||
|
||||
#[no_mangle]
|
||||
pub fn extern_fn() -> u8 { unsafe { extern_static } }
|
||||
pub fn extern_fn() -> u8 {
|
||||
unsafe { extern_static }
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub static mut extern_static: u8 = 71;
|
||||
|
@ -1,3 +1,2 @@
|
||||
#[no_mangle]
|
||||
pub fn bar() {
|
||||
}
|
||||
pub fn bar() {}
|
||||
|
@ -14,15 +14,18 @@
|
||||
#![no_core]
|
||||
|
||||
#[lang = "sized"]
|
||||
pub trait Sized { }
|
||||
pub trait Sized {}
|
||||
#[lang = "copy"]
|
||||
pub trait Copy { }
|
||||
pub trait Copy {}
|
||||
#[lang = "receiver"]
|
||||
pub trait Receiver { }
|
||||
pub trait Receiver {}
|
||||
#[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 {}
|
||||
@ -39,7 +42,7 @@ pub trait FnOnce<Args: Tuple> {
|
||||
}
|
||||
|
||||
#[lang = "fn_mut"]
|
||||
pub trait FnMut<Args: Tuple> : FnOnce<Args> {
|
||||
pub trait FnMut<Args: Tuple>: FnOnce<Args> {
|
||||
extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
|
||||
}
|
||||
|
||||
@ -64,7 +67,7 @@ fn arbitrary_black_box(ptr: &usize, _: &mut u32) -> Result<(), ()> {
|
||||
|
||||
#[inline(never)]
|
||||
#[no_mangle]
|
||||
fn call_through_fn_trait(a: &mut impl Fn<(), Output=()>) {
|
||||
fn call_through_fn_trait(a: &mut impl Fn<(), Output = ()>) {
|
||||
(*a)()
|
||||
}
|
||||
|
||||
@ -110,7 +113,10 @@ pub unsafe fn transmute_fn_ptr_to_data(x: fn()) -> *const () {
|
||||
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 }`,
|
||||
// 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_end_index_len_fail
|
||||
// CHECK-NOT: panic_bounds_check
|
||||
if let Ok(idx) = s.binary_search(&b'\\') {
|
||||
s[idx]
|
||||
} else {
|
||||
42
|
||||
}
|
||||
if let Ok(idx) = s.binary_search(&b'\\') { s[idx] } else { 42 }
|
||||
}
|
||||
|
||||
// Similarly, check that `partition_point` is known to return a valid fencepost.
|
||||
|
@ -10,9 +10,9 @@ use std::cmp::Ordering;
|
||||
// CHECK-LABEL: @cmp_bool
|
||||
#[no_mangle]
|
||||
pub fn cmp_bool(a: bool, b: bool) -> Ordering {
|
||||
// LLVM 10 produces (zext a) + (sext b), but the final lowering is (zext a) - (zext b).
|
||||
// CHECK: zext i1
|
||||
// CHECK: {{z|s}}ext i1
|
||||
// CHECK: {{sub|add}} nsw
|
||||
// LLVM 10 produces (zext a) + (sext b), but the final lowering is (zext a) - (zext b).
|
||||
// CHECK: zext i1
|
||||
// CHECK: {{z|s}}ext i1
|
||||
// CHECK: {{sub|add}} nsw
|
||||
a.cmp(&b)
|
||||
}
|
||||
|
@ -12,12 +12,11 @@
|
||||
#![feature(no_core, lang_items)]
|
||||
#![no_core]
|
||||
|
||||
#[lang="sized"]
|
||||
trait Sized { }
|
||||
#[lang = "sized"]
|
||||
trait Sized {}
|
||||
|
||||
// A basic test function.
|
||||
pub fn test() {
|
||||
}
|
||||
pub fn test() {}
|
||||
|
||||
// BTI: !"branch-target-enforcement", i32 1
|
||||
// BTI: !"sign-return-address", i32 0
|
||||
|
@ -18,9 +18,12 @@
|
||||
#![no_std]
|
||||
#![no_core]
|
||||
|
||||
#[lang="sized"] trait Sized { }
|
||||
#[lang="freeze"] trait Freeze { }
|
||||
#[lang="copy"] trait Copy { }
|
||||
#[lang = "sized"]
|
||||
trait Sized {}
|
||||
#[lang = "freeze"]
|
||||
trait Freeze {}
|
||||
#[lang = "copy"]
|
||||
trait Copy {}
|
||||
|
||||
// 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 }`.
|
||||
@ -104,7 +107,6 @@ pub unsafe fn return_twou16s() -> TwoU16s {
|
||||
// powerpc64: [[RETVAL:%.+]] = alloca [4 x i8], align 2
|
||||
// powerpc64: call void @returns_twou16s(ptr {{.+}} [[RETVAL]])
|
||||
|
||||
|
||||
// The other targets copy the cast ABI type to an alloca.
|
||||
|
||||
// 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]])
|
||||
|
||||
|
||||
// The other targets copy the cast ABI type to the sret pointer.
|
||||
|
||||
// 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: call void @returns_doubledouble(ptr {{.+}} [[RETVAL]])
|
||||
|
||||
|
||||
// The other targets copy the cast ABI type to an alloca.
|
||||
|
||||
// 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: call void @returns_doublefloat(ptr {{.+}} [[RETVAL]])
|
||||
|
||||
|
||||
// The other targets copy the cast ABI type to an alloca.
|
||||
|
||||
// aarch64: [[ABI_ALLOCA:%.+]] = alloca [16 x i8], align [[ABI_ALIGN:8]]
|
||||
|
@ -13,12 +13,11 @@
|
||||
#![feature(no_core, lang_items)]
|
||||
#![no_core]
|
||||
|
||||
#[lang="sized"]
|
||||
trait Sized { }
|
||||
#[lang = "sized"]
|
||||
trait Sized {}
|
||||
|
||||
// A basic test function.
|
||||
pub fn test() {
|
||||
}
|
||||
pub fn test() {}
|
||||
|
||||
// undefined-NOT: !"cf-protection-branch"
|
||||
// undefined-NOT: !"cf-protection-return"
|
||||
|
@ -2,12 +2,15 @@
|
||||
#![crate_type = "lib"]
|
||||
#![feature(ffi_const)]
|
||||
|
||||
pub fn bar() { unsafe { foo() } }
|
||||
pub fn bar() {
|
||||
unsafe { foo() }
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
// CHECK-LABEL: declare{{.*}}void @foo()
|
||||
// CHECK-SAME: [[ATTRS:#[0-9]+]]
|
||||
// The attribute changed from `readnone` to `memory(none)` with LLVM 16.0.
|
||||
// CHECK-DAG: attributes [[ATTRS]] = { {{.*}}{{readnone|memory\(none\)}}{{.*}} }
|
||||
#[ffi_const] pub fn foo();
|
||||
#[ffi_const]
|
||||
pub fn foo();
|
||||
}
|
||||
|
@ -13,9 +13,12 @@
|
||||
#![no_std]
|
||||
#![no_core]
|
||||
|
||||
#[lang="sized"] trait Sized { }
|
||||
#[lang="freeze"] trait Freeze { }
|
||||
#[lang="copy"] trait Copy { }
|
||||
#[lang = "sized"]
|
||||
trait Sized {}
|
||||
#[lang = "freeze"]
|
||||
trait Freeze {}
|
||||
#[lang = "copy"]
|
||||
trait Copy {}
|
||||
|
||||
#[repr(C)]
|
||||
struct S {
|
||||
|
@ -2,12 +2,15 @@
|
||||
#![crate_type = "lib"]
|
||||
#![feature(ffi_pure)]
|
||||
|
||||
pub fn bar() { unsafe { foo() } }
|
||||
pub fn bar() {
|
||||
unsafe { foo() }
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
// CHECK-LABEL: declare{{.*}}void @foo()
|
||||
// CHECK-SAME: [[ATTRS:#[0-9]+]]
|
||||
// The attribute changed from `readonly` to `memory(read)` with LLVM 16.0.
|
||||
// CHECK-DAG: attributes [[ATTRS]] = { {{.*}}{{readonly|memory\(read\)}}{{.*}} }
|
||||
#[ffi_pure] pub fn foo();
|
||||
#[ffi_pure]
|
||||
pub fn foo();
|
||||
}
|
||||
|
@ -4,8 +4,7 @@
|
||||
#![crate_type = "lib"]
|
||||
|
||||
// A basic test function.
|
||||
pub fn test() {
|
||||
}
|
||||
pub fn test() {}
|
||||
|
||||
// Ensure the module flag cfguard=2 is present
|
||||
// CHECK: !"cfguard", i32 2
|
||||
|
@ -4,8 +4,7 @@
|
||||
#![crate_type = "lib"]
|
||||
|
||||
// A basic test function.
|
||||
pub fn test() {
|
||||
}
|
||||
pub fn test() {}
|
||||
|
||||
// Ensure the module flag cfguard is not present
|
||||
// CHECK-NOT: !"cfguard"
|
||||
|
@ -4,8 +4,7 @@
|
||||
#![crate_type = "lib"]
|
||||
|
||||
// A basic test function.
|
||||
pub fn test() {
|
||||
}
|
||||
pub fn test() {}
|
||||
|
||||
// Ensure the module flag cfguard=1 is present
|
||||
// CHECK: !"cfguard", i32 1
|
||||
|
@ -4,8 +4,7 @@
|
||||
#![crate_type = "lib"]
|
||||
|
||||
// A basic test function.
|
||||
pub fn test() {
|
||||
}
|
||||
pub fn test() {}
|
||||
|
||||
// Ensure the cfguard module flag is not added for non-MSVC targets.
|
||||
// CHECK-NOT: !"cfguard"
|
||||
|
@ -7,7 +7,7 @@ static X: i32 = 5;
|
||||
// CHECK-LABEL: @raw_ptr_to_raw_ptr_noop
|
||||
// CHECK-NOT: alloca
|
||||
#[no_mangle]
|
||||
pub fn raw_ptr_to_raw_ptr_noop() -> *const i32{
|
||||
pub fn raw_ptr_to_raw_ptr_noop() -> *const i32 {
|
||||
&X as *const i32
|
||||
}
|
||||
|
||||
|
@ -8,18 +8,10 @@
|
||||
#[no_mangle]
|
||||
pub fn if_bool() {
|
||||
// CHECK: br label %{{.+}}
|
||||
_ = if true {
|
||||
0
|
||||
} else {
|
||||
1
|
||||
};
|
||||
_ = if true { 0 } else { 1 };
|
||||
|
||||
// CHECK: br label %{{.+}}
|
||||
_ = if false {
|
||||
0
|
||||
} else {
|
||||
1
|
||||
};
|
||||
_ = if false { 0 } else { 1 };
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @if_constant_int_eq
|
||||
@ -27,18 +19,10 @@ pub fn if_bool() {
|
||||
pub fn if_constant_int_eq() {
|
||||
let val = 0;
|
||||
// CHECK: br label %{{.+}}
|
||||
_ = if val == 0 {
|
||||
0
|
||||
} else {
|
||||
1
|
||||
};
|
||||
_ = if val == 0 { 0 } else { 1 };
|
||||
|
||||
// CHECK: br label %{{.+}}
|
||||
_ = if val == 1 {
|
||||
0
|
||||
} else {
|
||||
1
|
||||
};
|
||||
_ = if val == 1 { 0 } else { 1 };
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @if_constant_match
|
||||
@ -48,13 +32,13 @@ pub fn if_constant_match() {
|
||||
_ = match 1 {
|
||||
1 => 2,
|
||||
2 => 3,
|
||||
_ => 4
|
||||
_ => 4,
|
||||
};
|
||||
|
||||
// CHECK: br label %{{.+}}
|
||||
_ = match 1 {
|
||||
2 => 3,
|
||||
_ => 4
|
||||
_ => 4,
|
||||
};
|
||||
|
||||
// CHECK: br label %[[MINUS1:.+]]
|
||||
|
@ -11,7 +11,8 @@
|
||||
use std::ops::Coroutine;
|
||||
|
||||
fn coroutine_test() -> impl Coroutine<Yield = i32, Return = ()> {
|
||||
#[coroutine] || {
|
||||
#[coroutine]
|
||||
|| {
|
||||
yield 0;
|
||||
let s = String::from("foo");
|
||||
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: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant0", scope: [[GEN]],
|
||||
// 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-SAME: )
|
||||
// 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-SAME: )
|
||||
// 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-SAME: )
|
||||
// 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-SAME: )
|
||||
// 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-NOT: flags: DIFlagArtificial
|
||||
// CHECK-SAME: )
|
||||
|
@ -11,7 +11,8 @@
|
||||
use std::ops::Coroutine;
|
||||
|
||||
fn coroutine_test() -> impl Coroutine<Yield = i32, Return = ()> {
|
||||
#[coroutine] || {
|
||||
#[coroutine]
|
||||
|| {
|
||||
yield 0;
|
||||
let s = String::from("foo");
|
||||
yield 1;
|
||||
@ -26,26 +27,26 @@ fn coroutine_test() -> impl Coroutine<Yield = i32, Return = ()> {
|
||||
// CHECK-NOT: flags: DIFlagArtificial
|
||||
// CHECK-SAME: discriminator: [[DISC:![0-9]*]]
|
||||
// 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-SAME: )
|
||||
// CHECK: {{!.*}} = !DICompositeType(tag: DW_TAG_structure_type, name: "Unresumed", scope: [[GEN]],
|
||||
// CHECK-NOT: flags: DIFlagArtificial
|
||||
// CHECK-SAME: )
|
||||
// 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-SAME: )
|
||||
// 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-SAME: )
|
||||
// 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-SAME: )
|
||||
// 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-SAME: )
|
||||
// CHECK: [[S1:!.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "Suspend1", scope: [[GEN]],
|
||||
|
@ -1,13 +1,17 @@
|
||||
//@ compile-flags: -O
|
||||
|
||||
#![crate_type="lib"]
|
||||
#![crate_type = "lib"]
|
||||
|
||||
struct A;
|
||||
|
||||
impl Drop for A {
|
||||
fn drop(&mut self) {
|
||||
extern "C" { fn foo(); }
|
||||
unsafe { foo(); }
|
||||
extern "C" {
|
||||
fn foo();
|
||||
}
|
||||
unsafe {
|
||||
foo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
//@ ignore-windows
|
||||
//@ compile-flags: -C debuginfo=2
|
||||
|
||||
#[rustfmt::skip]
|
||||
fn main() {
|
||||
unsafe {
|
||||
// Column numbers are 1-based. Regression test for #65437.
|
||||
@ -13,8 +14,8 @@ fn main() {
|
||||
// CHECK: call void @turtle(){{( #[0-9]+)?}}, !dbg [[B:!.*]]
|
||||
/* ż */ turtle();
|
||||
|
||||
// CHECK: [[A]] = !DILocation(line: 10, column: 9,
|
||||
// CHECK: [[B]] = !DILocation(line: 14, column: 10,
|
||||
// CHECK: [[A]] = !DILocation(line: 11, column: 9,
|
||||
// CHECK: [[B]] = !DILocation(line: 15, column: 10,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
//
|
||||
// Ensure that we remap the compile unit directory and that we set it to the compilers current
|
||||
// working directory and not something else.
|
||||
#![crate_type="rlib"]
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
// CHECK-DAG: [[FILE:![0-9]*]] = !DIFile(filename: "/base/debug-compile-unit-path.rs{{.*}}", directory: "/cwd/")
|
||||
// CHECK-DAG: {{![0-9]*}} = distinct !DICompileUnit({{.*}}file: [[FILE]]
|
||||
|
@ -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]]
|
||||
// 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"]
|
||||
use std::future::Future;
|
||||
|
||||
@ -70,11 +69,9 @@ async fn generic_async_function<T: 'static>(x: T) -> T {
|
||||
x
|
||||
}
|
||||
|
||||
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
|
||||
async move {
|
||||
x
|
||||
}
|
||||
async move { x }
|
||||
}
|
||||
|
||||
pub fn instantiate_generics() {
|
||||
|
@ -1,13 +1,13 @@
|
||||
//@ no-prefer-dynamic
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
#[link(name = "dummy", kind="dylib")]
|
||||
#[link(name = "dummy", kind = "dylib")]
|
||||
extern "C" {
|
||||
pub fn dylib_func2(x: i32) -> i32;
|
||||
pub static dylib_global2: i32;
|
||||
}
|
||||
|
||||
#[link(name = "dummy", kind="static")]
|
||||
#[link(name = "dummy", kind = "static")]
|
||||
extern "C" {
|
||||
pub fn static_func2(x: i32) -> i32;
|
||||
pub static static_global2: i32;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// This test is for *-windows-msvc only.
|
||||
// This test is for *-windows-msvc only.
|
||||
//@ only-windows
|
||||
//@ ignore-gnu
|
||||
|
||||
@ -20,13 +20,13 @@ extern crate wrapper;
|
||||
// CHECK: declare noundef i32 @static_func1(i32 noundef)
|
||||
// CHECK: declare noundef i32 @static_func2(i32 noundef)
|
||||
|
||||
#[link(name = "dummy", kind="dylib")]
|
||||
#[link(name = "dummy", kind = "dylib")]
|
||||
extern "C" {
|
||||
pub fn dylib_func1(x: i32) -> i32;
|
||||
pub static dylib_global1: i32;
|
||||
}
|
||||
|
||||
#[link(name = "dummy", kind="static")]
|
||||
#[link(name = "dummy", kind = "static")]
|
||||
extern "C" {
|
||||
pub fn static_func1(x: i32) -> i32;
|
||||
pub static static_global1: i32;
|
||||
|
@ -3,7 +3,7 @@
|
||||
// Tests that the compiler can apply `noalias` and other &mut attributes to `drop_in_place`.
|
||||
// Note that non-Unpin types should not get `noalias`, matching &mut behavior.
|
||||
|
||||
#![crate_type="lib"]
|
||||
#![crate_type = "lib"]
|
||||
|
||||
use std::marker::PhantomPinned;
|
||||
|
||||
|
@ -7,28 +7,26 @@ struct SomeUniqueName;
|
||||
|
||||
impl Drop for SomeUniqueName {
|
||||
#[inline(never)]
|
||||
fn drop(&mut self) {
|
||||
}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
#[inline(never)]
|
||||
pub fn possibly_unwinding() {
|
||||
}
|
||||
pub fn possibly_unwinding() {}
|
||||
|
||||
// CHECK-LABEL: @droppy
|
||||
#[no_mangle]
|
||||
pub fn droppy() {
|
||||
// Check that there are exactly 6 drop calls. The cleanups for the unwinding should be reused, so
|
||||
// that's one new drop call per call to possibly_unwinding(), and finally 3 drop calls for the
|
||||
// regular function exit. We used to have problems with quadratic growths of drop calls in such
|
||||
// functions.
|
||||
// FIXME(eddyb) the `void @` forces a match on the instruction, instead of the
|
||||
// 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.
|
||||
// CHECK-COUNT-6: {{(call|invoke) void @.*}}drop_in_place{{.*}}SomeUniqueName
|
||||
// CHECK-NOT: {{(call|invoke) void @.*}}drop_in_place{{.*}}SomeUniqueName
|
||||
// The next line checks for the } that ends the function definition
|
||||
// CHECK-LABEL: {{^[}]}}
|
||||
// Check that there are exactly 6 drop calls. The cleanups for the unwinding should be reused,
|
||||
// so that's one new drop call per call to possibly_unwinding(), and finally 3 drop calls for
|
||||
// the regular function exit. We used to have problems with quadratic growths of drop calls in
|
||||
// such functions.
|
||||
// FIXME(eddyb) the `void @` forces a match on the instruction, instead of the
|
||||
// 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.
|
||||
// CHECK-COUNT-6: {{(call|invoke) void @.*}}drop_in_place{{.*}}SomeUniqueName
|
||||
// CHECK-NOT: {{(call|invoke) void @.*}}drop_in_place{{.*}}SomeUniqueName
|
||||
// The next line checks for the } that ends the function definition
|
||||
// CHECK-LABEL: {{^[}]}}
|
||||
let _s = SomeUniqueName;
|
||||
possibly_unwinding();
|
||||
let _s = SomeUniqueName;
|
||||
|
@ -3,7 +3,6 @@
|
||||
//@ compile-flags: -C no-prepopulate-passes -Copt-level=0
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
#![feature(extern_types)]
|
||||
|
||||
use std::ptr::addr_of;
|
||||
@ -11,8 +10,7 @@ use std::ptr::addr_of;
|
||||
// Hack to get the correct type for usize
|
||||
// CHECK: @helper([[USIZE:i[0-9]+]] %_1)
|
||||
#[no_mangle]
|
||||
pub fn helper(_: usize) {
|
||||
}
|
||||
pub fn helper(_: usize) {}
|
||||
|
||||
struct Dst<T: ?Sized> {
|
||||
x: u32,
|
||||
@ -23,30 +21,31 @@ struct Dst<T: ?Sized> {
|
||||
// CHECK: @dst_dyn_trait_offset(ptr align {{[0-9]+}} [[DATA_PTR:%.+]], ptr align {{[0-9]+}} [[VTABLE_PTR:%.+]])
|
||||
#[no_mangle]
|
||||
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: load [[USIZE]], ptr [[SIZE_PTR]]
|
||||
// CHECK: [[ALIGN_PTR:%[0-9]+]] = getelementptr inbounds i8, ptr [[VTABLE_PTR]]
|
||||
// CHECK: load [[USIZE]], ptr [[ALIGN_PTR]]
|
||||
// CHECK: [[SIZE_PTR:%[0-9]+]] = getelementptr inbounds i8, ptr [[VTABLE_PTR]]
|
||||
// CHECK: load [[USIZE]], ptr [[SIZE_PTR]]
|
||||
// CHECK: [[ALIGN_PTR:%[0-9]+]] = getelementptr inbounds i8, ptr [[VTABLE_PTR]]
|
||||
// CHECK: load [[USIZE]], ptr [[ALIGN_PTR]]
|
||||
|
||||
// CHECK: getelementptr inbounds i8, ptr [[DATA_PTR]]
|
||||
// CHECK-NEXT: insertvalue
|
||||
// CHECK-NEXT: insertvalue
|
||||
// CHECK-NEXT: ret
|
||||
// CHECK: getelementptr inbounds i8, ptr [[DATA_PTR]]
|
||||
// CHECK-NEXT: insertvalue
|
||||
// CHECK-NEXT: insertvalue
|
||||
// CHECK-NEXT: ret
|
||||
&s.z
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @dst_slice_offset
|
||||
#[no_mangle]
|
||||
pub fn dst_slice_offset(s: &Dst<[u16]>) -> &[u16] {
|
||||
// The alignment of [u16] is known, so we generate a GEP directly.
|
||||
// The alignment of [u16] is known, so we generate a GEP directly.
|
||||
|
||||
// CHECK: start:
|
||||
// CHECK-NEXT: getelementptr inbounds i8, {{.+}}, [[USIZE]] 6
|
||||
// CHECK-NEXT: insertvalue
|
||||
// CHECK-NEXT: insertvalue
|
||||
// CHECK-NEXT: ret
|
||||
// CHECK: start:
|
||||
// CHECK-NEXT: getelementptr inbounds i8, {{.+}}, [[USIZE]] 6
|
||||
// CHECK-NEXT: insertvalue
|
||||
// CHECK-NEXT: insertvalue
|
||||
// CHECK-NEXT: ret
|
||||
&s.z
|
||||
}
|
||||
|
||||
@ -60,25 +59,25 @@ struct PackedDstSlice {
|
||||
// CHECK-LABEL: @packed_dst_slice_offset
|
||||
#[no_mangle]
|
||||
pub fn packed_dst_slice_offset(s: &PackedDstSlice) -> *const [u16] {
|
||||
// The alignment of [u16] is known, so we generate a GEP directly.
|
||||
// The alignment of [u16] is known, so we generate a GEP directly.
|
||||
|
||||
// CHECK: start:
|
||||
// CHECK-NEXT: getelementptr inbounds i8, {{.+}}, [[USIZE]] 5
|
||||
// CHECK-NEXT: insertvalue
|
||||
// CHECK-NEXT: insertvalue
|
||||
// CHECK-NEXT: ret
|
||||
// CHECK: start:
|
||||
// CHECK-NEXT: getelementptr inbounds i8, {{.+}}, [[USIZE]] 5
|
||||
// CHECK-NEXT: insertvalue
|
||||
// CHECK-NEXT: insertvalue
|
||||
// CHECK-NEXT: ret
|
||||
addr_of!(s.z)
|
||||
}
|
||||
|
||||
extern {
|
||||
extern "C" {
|
||||
pub type Extern;
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @dst_extern
|
||||
#[no_mangle]
|
||||
pub fn dst_extern(s: &Dst<Extern>) -> &Extern {
|
||||
// Computing the alignment of an extern type is currently unsupported and just panics.
|
||||
// Computing the alignment of an extern type is currently unsupported and just panics.
|
||||
|
||||
// CHECK: call void @{{.+}}panic
|
||||
// CHECK: call void @{{.+}}panic
|
||||
&s.z
|
||||
}
|
||||
|
@ -10,9 +10,15 @@ pub trait Trait {
|
||||
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> {
|
||||
_field: i8,
|
||||
@ -22,7 +28,7 @@ pub struct Struct<W: ?Sized> {
|
||||
// CHECK-LABEL: @eliminates_runtime_check_when_align_1
|
||||
#[no_mangle]
|
||||
pub fn eliminates_runtime_check_when_align_1(
|
||||
x: &Struct<WrapperWithAlign1<dyn Trait>>
|
||||
x: &Struct<WrapperWithAlign1<dyn Trait>>,
|
||||
) -> &WrapperWithAlign1<dyn Trait> {
|
||||
// CHECK: load [[USIZE:i[0-9]+]], {{.+}} !range [[RANGE_META:![0-9]+]]
|
||||
// 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
|
||||
#[no_mangle]
|
||||
pub fn does_not_eliminate_runtime_check_when_align_2(
|
||||
x: &Struct<WrapperWithAlign2<dyn Trait>>
|
||||
x: &Struct<WrapperWithAlign2<dyn Trait>>,
|
||||
) -> &WrapperWithAlign2<dyn Trait> {
|
||||
// CHECK: [[X0:%[0-9]+]] = load [[USIZE]], {{.+}} !range [[RANGE_META]]
|
||||
// CHECK: {{icmp|llvm.umax}}
|
||||
|
@ -3,8 +3,7 @@
|
||||
#![crate_type = "lib"]
|
||||
|
||||
// A basic test function.
|
||||
pub fn test() {
|
||||
}
|
||||
pub fn test() {}
|
||||
|
||||
// Ensure the module flag ehcontguard is not present
|
||||
// CHECK-NOT: !"ehcontguard"
|
||||
|
@ -3,8 +3,7 @@
|
||||
#![crate_type = "lib"]
|
||||
|
||||
// A basic test function.
|
||||
pub fn test() {
|
||||
}
|
||||
pub fn test() {}
|
||||
|
||||
// Ensure the module flag ehcontguard=1 is present
|
||||
// CHECK: !"ehcontguard", i32 1
|
||||
|
@ -9,18 +9,23 @@
|
||||
#![no_std]
|
||||
#![no_core]
|
||||
|
||||
#[lang="sized"] trait Sized { }
|
||||
#[lang="freeze"] trait Freeze { }
|
||||
#[lang="copy"] trait Copy { }
|
||||
#[lang = "sized"]
|
||||
trait Sized {}
|
||||
#[lang = "freeze"]
|
||||
trait Freeze {}
|
||||
#[lang = "copy"]
|
||||
trait Copy {}
|
||||
|
||||
#[rustc_intrinsic]
|
||||
fn size_of<T>() -> usize { loop {} }
|
||||
fn size_of<T>() -> usize {
|
||||
loop {}
|
||||
}
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
fn catch_unwind(
|
||||
try_fn: fn(_: *mut u8),
|
||||
data: *mut u8,
|
||||
catch_fn: fn(_: *mut u8, _: *mut u8)
|
||||
catch_fn: fn(_: *mut u8, _: *mut u8),
|
||||
) -> i32;
|
||||
}
|
||||
|
||||
@ -36,7 +41,7 @@ pub fn ptr_size() -> usize {
|
||||
pub unsafe fn test_catch_unwind(
|
||||
try_fn: fn(_: *mut u8),
|
||||
data: *mut u8,
|
||||
catch_fn: fn(_: *mut u8, _: *mut u8)
|
||||
catch_fn: fn(_: *mut u8, _: *mut u8),
|
||||
) -> i32 {
|
||||
// CHECK: start:
|
||||
// CHECK: [[ALLOCA:%.*]] = alloca
|
||||
|
@ -2,9 +2,8 @@
|
||||
//
|
||||
//@ compile-flags: -Clto -Ctarget-feature=-crt-static -Zsplit-lto-unit
|
||||
|
||||
#![crate_type="lib"]
|
||||
#![crate_type = "lib"]
|
||||
|
||||
pub fn foo() {
|
||||
}
|
||||
pub fn foo() {}
|
||||
|
||||
// CHECK: !{{[0-9]+}} = !{i32 4, !"EnableSplitLTOUnit", i32 1}
|
||||
|
@ -3,7 +3,8 @@
|
||||
#![crate_type = "lib"]
|
||||
|
||||
pub enum Foo {
|
||||
A, B
|
||||
A,
|
||||
B,
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @lookup
|
||||
@ -15,7 +16,7 @@ pub fn lookup(buf: &[u8; 2], f: Foo) -> u8 {
|
||||
|
||||
pub enum Bar {
|
||||
A = 2,
|
||||
B = 3
|
||||
B = 3,
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @lookup_unmodified
|
||||
|
@ -17,7 +17,11 @@
|
||||
#![allow(unused_variables)]
|
||||
#![allow(unused_assignments)]
|
||||
|
||||
enum E { A, B, C }
|
||||
enum E {
|
||||
A,
|
||||
B,
|
||||
C,
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let e = E::C;
|
||||
|
@ -23,7 +23,12 @@
|
||||
#![allow(unused_variables)]
|
||||
#![allow(unused_assignments)]
|
||||
|
||||
enum E { A, B, C, D(bool) }
|
||||
enum E {
|
||||
A,
|
||||
B,
|
||||
C,
|
||||
D(bool),
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let e = E::D(true);
|
||||
|
@ -21,7 +21,10 @@
|
||||
#![allow(unused_variables)]
|
||||
#![allow(unused_assignments)]
|
||||
|
||||
enum E { A(u32), B(u32) }
|
||||
enum E {
|
||||
A(u32),
|
||||
B(u32),
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let e = E::A(23);
|
||||
|
@ -50,6 +50,7 @@ pub fn match1(e: Enum1) -> u8 {
|
||||
}
|
||||
|
||||
// Case 2: Special cases don't apply.
|
||||
#[rustfmt::skip]
|
||||
pub enum X {
|
||||
_2=2, _3, _4, _5, _6, _7, _8, _9, _10, _11,
|
||||
_12, _13, _14, _15, _16, _17, _18, _19, _20,
|
||||
|
@ -22,8 +22,7 @@ const C: Int = Int(153);
|
||||
// CHECK-NEXT: ret i1 [[SPEC_SELECT]]
|
||||
#[no_mangle]
|
||||
pub fn implicit_match(x: Int) -> bool {
|
||||
(x >= A && x <= B)
|
||||
|| x == C
|
||||
(x >= A && x <= B) || x == C
|
||||
}
|
||||
|
||||
// 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
|
||||
#[no_mangle]
|
||||
pub fn if_let(val: Result<i32, ()>) -> Result<i32, ()> {
|
||||
if let Ok(x) = val {
|
||||
Ok(x)
|
||||
} else {
|
||||
Err(())
|
||||
}
|
||||
if let Ok(x) = val { Ok(x) } else { Err(()) }
|
||||
}
|
||||
|
@ -7,6 +7,6 @@ pub trait T {}
|
||||
// CHECK-LABEL: @copy_fat_ptr
|
||||
#[no_mangle]
|
||||
pub fn copy_fat_ptr(x: &T) {
|
||||
// CHECK-NOT: extractvalue
|
||||
// CHECK-NOT: extractvalue
|
||||
let x2 = x;
|
||||
}
|
||||
|
@ -3,48 +3,40 @@
|
||||
#![crate_type = "lib"]
|
||||
#![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
|
||||
#[no_mangle]
|
||||
pub fn add(x: f32, y: f32) -> f32 {
|
||||
// CHECK: fadd float
|
||||
// CHECK-NOT: fast
|
||||
// CHECK: fadd float
|
||||
// CHECK-NOT: fast
|
||||
x + y
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @addition
|
||||
#[no_mangle]
|
||||
pub fn addition(x: f32, y: f32) -> f32 {
|
||||
// CHECK: fadd fast float
|
||||
unsafe {
|
||||
fadd_fast(x, y)
|
||||
}
|
||||
// CHECK: fadd fast float
|
||||
unsafe { fadd_fast(x, y) }
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @subtraction
|
||||
#[no_mangle]
|
||||
pub fn subtraction(x: f32, y: f32) -> f32 {
|
||||
// CHECK: fsub fast float
|
||||
unsafe {
|
||||
fsub_fast(x, y)
|
||||
}
|
||||
// CHECK: fsub fast float
|
||||
unsafe { fsub_fast(x, y) }
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @multiplication
|
||||
#[no_mangle]
|
||||
pub fn multiplication(x: f32, y: f32) -> f32 {
|
||||
// CHECK: fmul fast float
|
||||
unsafe {
|
||||
fmul_fast(x, y)
|
||||
}
|
||||
// CHECK: fmul fast float
|
||||
unsafe { fmul_fast(x, y) }
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @division
|
||||
#[no_mangle]
|
||||
pub fn division(x: f32, y: f32) -> f32 {
|
||||
// CHECK: fdiv fast float
|
||||
unsafe {
|
||||
fdiv_fast(x, y)
|
||||
}
|
||||
// CHECK: fdiv fast float
|
||||
unsafe { fdiv_fast(x, y) }
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
//@ compile-flags: -C no-prepopulate-passes -C force-frame-pointers=y -Copt-level=0
|
||||
|
||||
#![crate_type="lib"]
|
||||
#![crate_type = "lib"]
|
||||
|
||||
// CHECK: attributes #{{.*}} "frame-pointer"="all"
|
||||
pub fn foo() {}
|
||||
|
@ -1,7 +1,7 @@
|
||||
//@ compile-flags: -C no-prepopulate-passes -C panic=abort -C force-unwind-tables=n
|
||||
//@ ignore-windows
|
||||
|
||||
#![crate_type="lib"]
|
||||
#![crate_type = "lib"]
|
||||
|
||||
// CHECK-LABEL: define{{.*}}void @foo
|
||||
// CHECK-NOT: attributes #{{.*}} uwtable
|
||||
|
@ -1,6 +1,6 @@
|
||||
//@ compile-flags: -C no-prepopulate-passes -C force-unwind-tables=y -Copt-level=0
|
||||
|
||||
#![crate_type="lib"]
|
||||
#![crate_type = "lib"]
|
||||
|
||||
// CHECK: attributes #{{.*}} uwtable
|
||||
pub fn foo() {}
|
||||
|
@ -13,13 +13,12 @@
|
||||
|
||||
#![feature(no_core, lang_items)]
|
||||
#![no_core]
|
||||
#[lang="sized"]
|
||||
trait Sized { }
|
||||
#[lang="copy"]
|
||||
trait Copy { }
|
||||
#[lang = "sized"]
|
||||
trait Sized {}
|
||||
#[lang = "copy"]
|
||||
trait Copy {}
|
||||
impl Copy for u32 {}
|
||||
|
||||
|
||||
// CHECK: define i32 @peach{{.*}}[[PEACH_ATTRS:\#[0-9]+]] {
|
||||
#[no_mangle]
|
||||
pub fn peach(x: u32) -> u32 {
|
||||
|
@ -19,7 +19,7 @@ pub fn boolean(x: bool) -> bool {
|
||||
// CHECK-LABEL: @boolean_call
|
||||
#[no_mangle]
|
||||
pub fn boolean_call(x: bool, f: fn(bool) -> bool) -> bool {
|
||||
// CHECK: call zeroext i1 %f(i1 zeroext %x)
|
||||
// CHECK: call zeroext i1 %f(i1 zeroext %x)
|
||||
f(x)
|
||||
}
|
||||
|
||||
|
@ -3,9 +3,9 @@
|
||||
#![feature(dyn_star)]
|
||||
#![feature(allocator_api)]
|
||||
|
||||
use std::marker::PhantomPinned;
|
||||
use std::mem::MaybeUninit;
|
||||
use std::num::NonZero;
|
||||
use std::marker::PhantomPinned;
|
||||
use std::ptr::NonNull;
|
||||
|
||||
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)
|
||||
// FIXME #25759 This should also have `nocapture`
|
||||
#[no_mangle]
|
||||
pub fn readonly_borrow(_: &i32) {
|
||||
}
|
||||
pub fn readonly_borrow(_: &i32) {}
|
||||
|
||||
// CHECK: noundef align 4 dereferenceable(4) ptr @readonly_borrow_ret()
|
||||
#[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)
|
||||
// static borrow may be captured
|
||||
#[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)
|
||||
// borrow with named lifetime may be captured
|
||||
#[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)
|
||||
// unsafe interior means this isn't actually readonly and there may be aliases ...
|
||||
#[no_mangle]
|
||||
pub fn unsafe_borrow(_: &UnsafeInner) {
|
||||
}
|
||||
pub fn unsafe_borrow(_: &UnsafeInner) {}
|
||||
|
||||
// CHECK: @mutable_unsafe_borrow(ptr noalias noundef align 2 dereferenceable(2) %_1)
|
||||
// ... unless this is a mutable borrow, those never alias
|
||||
#[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)
|
||||
// FIXME #25759 This should also have `nocapture`
|
||||
#[no_mangle]
|
||||
pub fn mutable_borrow(_: &mut i32) {
|
||||
}
|
||||
pub fn mutable_borrow(_: &mut i32) {}
|
||||
|
||||
// CHECK: noundef align 4 dereferenceable(4) ptr @mutable_borrow_ret()
|
||||
#[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.
|
||||
// It is also not `dereferenceable` due to
|
||||
// <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)
|
||||
// But `&NotUnpin` behaves perfectly normal.
|
||||
#[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)
|
||||
#[no_mangle]
|
||||
pub fn indirect_struct(_: S) {
|
||||
}
|
||||
pub fn indirect_struct(_: S) {}
|
||||
|
||||
// CHECK: @borrowed_struct(ptr noalias noundef readonly align 4 dereferenceable(32) %_1)
|
||||
// FIXME #25759 This should also have `nocapture`
|
||||
#[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)
|
||||
#[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)
|
||||
#[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)
|
||||
#[no_mangle]
|
||||
pub fn raw_struct(_: *const S) {
|
||||
}
|
||||
pub fn raw_struct(_: *const S) {}
|
||||
|
||||
// CHECK: @raw_option_nonnull_struct(ptr noundef %_1)
|
||||
#[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
|
||||
// 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)?}})
|
||||
#[no_mangle]
|
||||
pub fn struct_return() -> S {
|
||||
S {
|
||||
_field: [0, 0, 0, 0, 0, 0, 0, 0]
|
||||
}
|
||||
S { _field: [0, 0, 0, 0, 0, 0, 0, 0] }
|
||||
}
|
||||
|
||||
// Hack to get the correct size for the length part in slices
|
||||
// CHECK: @helper([[USIZE:i[0-9]+]] noundef %_1)
|
||||
#[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)
|
||||
// FIXME #25759 This should also have `nocapture`
|
||||
#[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)
|
||||
// FIXME #25759 This should also have `nocapture`
|
||||
#[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)
|
||||
// unsafe interior means this isn't actually readonly and there may be aliases ...
|
||||
#[no_mangle]
|
||||
pub fn unsafe_slice(_: &[UnsafeInner]) {
|
||||
}
|
||||
pub fn unsafe_slice(_: &[UnsafeInner]) {}
|
||||
|
||||
// CHECK: @raw_slice(ptr noundef %_1.0, [[USIZE]] noundef %_1.1)
|
||||
#[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)
|
||||
// FIXME #25759 This should also have `nocapture`
|
||||
#[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)
|
||||
// FIXME #25759 This should also have `nocapture`
|
||||
#[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)
|
||||
#[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)
|
||||
#[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)
|
||||
#[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)?}})
|
||||
#[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)
|
||||
#[no_mangle]
|
||||
|
@ -13,6 +13,6 @@
|
||||
|
||||
pub struct Generic<Type>(Type);
|
||||
|
||||
fn main () {
|
||||
fn main() {
|
||||
let generic = Generic(10);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
//@[SIZE-OPT] compile-flags: -Copt-level=s
|
||||
//@[SPEED-OPT] compile-flags: -Copt-level=3
|
||||
|
||||
#![crate_type="rlib"]
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
#[no_mangle]
|
||||
#[inline(always)]
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![crate_type="rlib"]
|
||||
#![crate_type = "rlib"]
|
||||
//@ compile-flags: -Copt-level=3 -g
|
||||
//
|
||||
|
||||
|
@ -12,12 +12,10 @@
|
||||
// CHECK: @__llvm_profile_filename = {{.*}}"default_%m_%p.profraw\00"{{.*}}
|
||||
// CHECK: @__llvm_coverage_mapping
|
||||
|
||||
#![crate_type="lib"]
|
||||
#![crate_type = "lib"]
|
||||
|
||||
#[inline(never)]
|
||||
fn some_function() {
|
||||
|
||||
}
|
||||
fn some_function() {}
|
||||
|
||||
pub fn some_other_function() {
|
||||
some_function();
|
||||
|
@ -10,19 +10,19 @@ use std::cmp::Ordering;
|
||||
// CHECK-LABEL: @cmp_signed
|
||||
#[no_mangle]
|
||||
pub fn cmp_signed(a: i64, b: i64) -> Ordering {
|
||||
// CHECK: icmp slt
|
||||
// CHECK: icmp ne
|
||||
// CHECK: zext i1
|
||||
// CHECK: select i1
|
||||
// CHECK: icmp slt
|
||||
// CHECK: icmp ne
|
||||
// CHECK: zext i1
|
||||
// CHECK: select i1
|
||||
a.cmp(&b)
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @cmp_unsigned
|
||||
#[no_mangle]
|
||||
pub fn cmp_unsigned(a: u32, b: u32) -> Ordering {
|
||||
// CHECK: icmp ult
|
||||
// CHECK: icmp ne
|
||||
// CHECK: zext i1
|
||||
// CHECK: select i1
|
||||
// CHECK: icmp ult
|
||||
// CHECK: icmp ne
|
||||
// CHECK: zext i1
|
||||
// CHECK: select i1
|
||||
a.cmp(&b)
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
||||
pub struct S1<'a> {
|
||||
data: &'a [u8],
|
||||
position: usize,
|
||||
@ -12,7 +11,7 @@ pub struct S1<'a> {
|
||||
#[no_mangle]
|
||||
pub fn slice_no_index_order<'a>(s: &'a mut S1, n: usize) -> &'a [u8] {
|
||||
// CHECK-NOT: slice_index_order_fail
|
||||
let d = &s.data[s.position..s.position+n];
|
||||
let d = &s.data[s.position..s.position + n];
|
||||
s.position += n;
|
||||
return d;
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
//@ compile-flags: -C no-prepopulate-passes -Zmir-opt-level=0
|
||||
|
||||
pub fn main() {
|
||||
|
||||
// We want to make sure that closures get 'internal' linkage instead of
|
||||
// 'weak_odr' when they are not shared between codegen units
|
||||
// FIXME(eddyb) `legacy` mangling uses `{{closure}}`, while `v0`
|
||||
@ -9,6 +8,6 @@ pub fn main() {
|
||||
// CHECK-LABEL: ; internalize_closures::main::{{.*}}closure
|
||||
// CHECK-NEXT: ; Function Attrs:
|
||||
// CHECK-NEXT: define internal
|
||||
let c = |x:i32| { x + 1 };
|
||||
let c = |x: i32| x + 1;
|
||||
let _ = c(1);
|
||||
}
|
||||
|
@ -8,5 +8,7 @@ extern "rust-intrinsic" {
|
||||
// CHECK: @llvm.sqrt.f32(float) #{{[0-9]*}}
|
||||
|
||||
fn main() {
|
||||
unsafe { sqrtf32(0.0f32); }
|
||||
unsafe {
|
||||
sqrtf32(0.0f32);
|
||||
}
|
||||
}
|
||||
|
@ -6,10 +6,14 @@
|
||||
|
||||
use std::intrinsics::const_eval_select;
|
||||
|
||||
const fn foo(_: i32) -> i32 { 1 }
|
||||
const fn foo(_: i32) -> i32 {
|
||||
1
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub fn hi(n: i32) -> i32 { n }
|
||||
pub fn hi(n: i32) -> i32 {
|
||||
n
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe fn hey() {
|
||||
|
@ -3,17 +3,13 @@
|
||||
#![crate_type = "lib"]
|
||||
#![feature(core_intrinsics)]
|
||||
|
||||
use std::intrinsics::{likely,unlikely};
|
||||
use std::intrinsics::{likely, unlikely};
|
||||
|
||||
#[no_mangle]
|
||||
pub fn check_likely(x: i32, y: i32) -> Option<i32> {
|
||||
unsafe {
|
||||
// CHECK: call i1 @llvm.expect.i1(i1 %{{.*}}, i1 true)
|
||||
if likely(x == y) {
|
||||
None
|
||||
} else {
|
||||
Some(x + y)
|
||||
}
|
||||
if likely(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> {
|
||||
unsafe {
|
||||
// CHECK: call i1 @llvm.expect.i1(i1 %{{.*}}, i1 false)
|
||||
if unlikely(x == y) {
|
||||
None
|
||||
} else {
|
||||
Some(x + y)
|
||||
}
|
||||
if unlikely(x == y) { None } else { Some(x + y) }
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,9 @@
|
||||
#![crate_type = "lib"]
|
||||
#![feature(core_intrinsics)]
|
||||
|
||||
use std::intrinsics::{prefetch_read_data, prefetch_write_data,
|
||||
prefetch_read_instruction, prefetch_write_instruction};
|
||||
use std::intrinsics::{
|
||||
prefetch_read_data, prefetch_read_instruction, prefetch_write_data, prefetch_write_instruction,
|
||||
};
|
||||
|
||||
#[no_mangle]
|
||||
pub fn check_prefetch_read_data(data: &[i8]) {
|
||||
|
@ -75,7 +75,7 @@ pub fn _slice_ref(a: &[u8]) -> i32 {
|
||||
#[no_mangle]
|
||||
pub fn _slice_ref_borrow() -> i32 {
|
||||
// CHECK: ret i32 6
|
||||
_slice_ref(&[0;3])
|
||||
_slice_ref(&[0; 3])
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @_slice_ref_arg(
|
||||
|
@ -16,6 +16,6 @@ pub fn issue97217() -> i32 {
|
||||
let v1 = vec![5, 6, 7];
|
||||
let v1_iter = v1.iter();
|
||||
let total: i32 = v1_iter.sum();
|
||||
println!("{}",total);
|
||||
println!("{}", total);
|
||||
total
|
||||
}
|
||||
|
@ -9,9 +9,5 @@ pub fn test(a: i32, b: i32) -> bool {
|
||||
let c1 = (a >= 0) && (a <= 10);
|
||||
let c2 = (b >= 0) && (b <= 20);
|
||||
|
||||
if c1 & c2 {
|
||||
a + 100 != b
|
||||
} else {
|
||||
true
|
||||
}
|
||||
if c1 & c2 { a + 100 != b } else { true }
|
||||
}
|
||||
|
@ -6,7 +6,8 @@ pub struct S([usize; 8]);
|
||||
|
||||
#[no_mangle]
|
||||
pub fn outer_function(x: S, y: S) -> usize {
|
||||
(#[inline(always)]|| {
|
||||
(#[inline(always)]
|
||||
|| {
|
||||
let _z = x;
|
||||
y.0[0]
|
||||
})()
|
||||
|
@ -5,8 +5,8 @@
|
||||
//@ only-64bit (because the LLVM type of i64 for usize shows up)
|
||||
#![crate_type = "lib"]
|
||||
|
||||
use core::ptr::NonNull;
|
||||
use core::num::NonZero;
|
||||
use core::ptr::NonNull;
|
||||
|
||||
// CHECK-LABEL: @check_non_null
|
||||
#[no_mangle]
|
||||
@ -73,7 +73,7 @@ pub fn isize_try_from_i32(x: NonZero<i32>) -> NonZero<isize> {
|
||||
|
||||
// CHECK-LABEL: @u64_from_nonzero_is_not_zero
|
||||
#[no_mangle]
|
||||
pub fn u64_from_nonzero_is_not_zero(x: NonZero<u64>)->bool {
|
||||
pub fn u64_from_nonzero_is_not_zero(x: NonZero<u64>) -> bool {
|
||||
// CHECK-NOT: br
|
||||
// CHECK: ret i1 false
|
||||
// CHECK-NOT: br
|
||||
|
@ -6,6 +6,6 @@
|
||||
use std::rc::Rc;
|
||||
|
||||
pub fn foo(t: &Rc<Vec<usize>>) {
|
||||
// CHECK-NOT: __rust_dealloc
|
||||
// CHECK-NOT: __rust_dealloc
|
||||
drop(t.clone());
|
||||
}
|
||||
|
@ -7,10 +7,9 @@
|
||||
struct Foo;
|
||||
|
||||
impl Foo {
|
||||
// CHECK: define internal x86_stdcallcc void @{{.*}}foo{{.*}}()
|
||||
// CHECK: define internal x86_stdcallcc void @{{.*}}foo{{.*}}()
|
||||
#[inline(never)]
|
||||
pub extern "stdcall" fn foo<T>() {
|
||||
}
|
||||
pub extern "stdcall" fn foo<T>() {}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -9,26 +9,26 @@ use std::slice::Iter;
|
||||
|
||||
#[no_mangle]
|
||||
pub fn is_empty_1(xs: Iter<f32>) -> bool {
|
||||
// CHECK-LABEL: @is_empty_1(
|
||||
// CHECK-NEXT: start:
|
||||
// CHECK-NEXT: [[A:%.*]] = icmp ne ptr {{%xs.0|%xs.1}}, null
|
||||
// CHECK-NEXT: tail call void @llvm.assume(i1 [[A]])
|
||||
// The order between %xs.0 and %xs.1 on the next line doesn't matter
|
||||
// and different LLVM versions produce different order.
|
||||
// CHECK-NEXT: [[B:%.*]] = icmp eq ptr {{%xs.0, %xs.1|%xs.1, %xs.0}}
|
||||
// CHECK-NEXT: ret i1 [[B:%.*]]
|
||||
{xs}.next().is_none()
|
||||
// CHECK-LABEL: @is_empty_1(
|
||||
// CHECK-NEXT: start:
|
||||
// CHECK-NEXT: [[A:%.*]] = icmp ne ptr {{%xs.0|%xs.1}}, null
|
||||
// CHECK-NEXT: tail call void @llvm.assume(i1 [[A]])
|
||||
// The order between %xs.0 and %xs.1 on the next line doesn't matter
|
||||
// and different LLVM versions produce different order.
|
||||
// CHECK-NEXT: [[B:%.*]] = icmp eq ptr {{%xs.0, %xs.1|%xs.1, %xs.0}}
|
||||
// CHECK-NEXT: ret i1 [[B:%.*]]
|
||||
{ xs }.next().is_none()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub fn is_empty_2(xs: Iter<f32>) -> bool {
|
||||
// CHECK-LABEL: @is_empty_2
|
||||
// CHECK-NEXT: start:
|
||||
// CHECK-NEXT: [[C:%.*]] = icmp ne ptr {{%xs.0|%xs.1}}, null
|
||||
// CHECK-NEXT: tail call void @llvm.assume(i1 [[C]])
|
||||
// The order between %xs.0 and %xs.1 on the next line doesn't matter
|
||||
// and different LLVM versions produce different order.
|
||||
// CHECK-NEXT: [[D:%.*]] = icmp eq ptr {{%xs.0, %xs.1|%xs.1, %xs.0}}
|
||||
// CHECK-NEXT: ret i1 [[D:%.*]]
|
||||
// CHECK-LABEL: @is_empty_2
|
||||
// CHECK-NEXT: start:
|
||||
// CHECK-NEXT: [[C:%.*]] = icmp ne ptr {{%xs.0|%xs.1}}, null
|
||||
// CHECK-NEXT: tail call void @llvm.assume(i1 [[C]])
|
||||
// The order between %xs.0 and %xs.1 on the next line doesn't matter
|
||||
// and different LLVM versions produce different order.
|
||||
// CHECK-NEXT: [[D:%.*]] = icmp eq ptr {{%xs.0, %xs.1|%xs.1, %xs.0}}
|
||||
// CHECK-NEXT: ret i1 [[D:%.*]]
|
||||
xs.map(|&x| x).next().is_none()
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
//@ compile-flags: -O
|
||||
|
||||
#![crate_type="rlib"]
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
// CHECK-LABEL: @memzero
|
||||
// CHECK-NOT: store
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
//@ compile-flags: -O
|
||||
|
||||
#![crate_type="rlib"]
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
// CHECK-LABEL: @test
|
||||
#[no_mangle]
|
||||
|
@ -1,9 +1,11 @@
|
||||
// -C no-prepopulate-passes
|
||||
#![crate_type="staticlib"]
|
||||
#![crate_type = "staticlib"]
|
||||
|
||||
#[repr(C)]
|
||||
pub struct Foo(u64);
|
||||
|
||||
// CHECK: define {{.*}} @foo(
|
||||
#[no_mangle]
|
||||
pub extern "C" fn foo(_: Foo) -> Foo { loop {} }
|
||||
pub extern "C" fn foo(_: Foo) -> Foo {
|
||||
loop {}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
// CHECK-NOT: Unwind
|
||||
|
||||
#![feature(test)]
|
||||
#![crate_type="rlib"]
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
extern crate test;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
//@ compile-flags: -C no-prepopulate-passes
|
||||
|
||||
#![crate_type="rlib"]
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub struct Foo<T> {
|
||||
|
@ -1,6 +1,6 @@
|
||||
//@ compile-flags: -C no-prepopulate-passes
|
||||
|
||||
#![crate_type="rlib"]
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub struct Foo<T> {
|
||||
|
@ -1,6 +1,6 @@
|
||||
//@ compile-flags: -C no-prepopulate-passes
|
||||
|
||||
#![crate_type="rlib"]
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
#[repr(align(16))]
|
||||
pub struct S {
|
||||
|
@ -12,11 +12,7 @@ pub enum All {
|
||||
// CHECK-LABEL: @issue_73031
|
||||
#[no_mangle]
|
||||
pub fn issue_73031(a: &mut All, q: i32) -> i32 {
|
||||
*a = if q == 5 {
|
||||
All::Foo
|
||||
} else {
|
||||
All::Bar
|
||||
};
|
||||
*a = if q == 5 { All::Foo } else { All::Bar };
|
||||
match *a {
|
||||
// CHECK-NOT: panic
|
||||
All::None => panic!(),
|
||||
|
@ -7,7 +7,10 @@
|
||||
#[derive(Clone, Copy)]
|
||||
#[repr(u8)]
|
||||
pub enum Foo {
|
||||
A, B, C, D,
|
||||
A,
|
||||
B,
|
||||
C,
|
||||
D,
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @issue_73258(
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
//@ compile-flags: -Copt-level=3
|
||||
|
||||
#![crate_type="lib"]
|
||||
#![crate_type = "lib"]
|
||||
|
||||
#[repr(u32)]
|
||||
#[derive(Copy, Clone, Eq, PartialEq, PartialOrd)]
|
||||
@ -15,25 +15,25 @@ pub enum Foo {
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub fn compare_less(a: Foo, b: Foo)->bool{
|
||||
pub fn compare_less(a: Foo, b: Foo) -> bool {
|
||||
// CHECK-NOT: br {{.*}}
|
||||
a < b
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub fn compare_le(a: Foo, b: Foo)->bool{
|
||||
pub fn compare_le(a: Foo, b: Foo) -> bool {
|
||||
// CHECK-NOT: br {{.*}}
|
||||
a <= b
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub fn compare_ge(a: Foo, b: Foo)->bool{
|
||||
pub fn compare_ge(a: Foo, b: Foo) -> bool {
|
||||
// CHECK-NOT: br {{.*}}
|
||||
a >= b
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub fn compare_greater(a: Foo, b: Foo)->bool{
|
||||
pub fn compare_greater(a: Foo, b: Foo) -> bool {
|
||||
// CHECK-NOT: br {{.*}}
|
||||
a > b
|
||||
}
|
||||
|
@ -12,11 +12,7 @@ pub fn position_slice_to_no_bounds_check(s: &[u8]) -> &[u8] {
|
||||
// CHECK-NOT: slice_end_index_len_fail
|
||||
// CHECK-NOT: panic_bounds_check
|
||||
// CHECK-NOT: unreachable
|
||||
if let Some(idx) = s.iter().position(|b| *b == b'\\') {
|
||||
&s[..idx]
|
||||
} else {
|
||||
s
|
||||
}
|
||||
if let Some(idx) = s.iter().position(|b| *b == b'\\') { &s[..idx] } else { s }
|
||||
}
|
||||
|
||||
// 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: panic_bounds_check
|
||||
// CHECK-NOT: unreachable
|
||||
if let Some(idx) = s.iter().position(|b| *b == b'\\') {
|
||||
&s[idx..]
|
||||
} else {
|
||||
s
|
||||
}
|
||||
if let Some(idx) = s.iter().position(|b| *b == b'\\') { &s[idx..] } else { s }
|
||||
}
|
||||
|
||||
// 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: panic_bounds_check
|
||||
// CHECK-NOT: unreachable
|
||||
if let Some(idx) = s.iter().position(|b| *b == b'\\') {
|
||||
s[idx]
|
||||
} else {
|
||||
42
|
||||
}
|
||||
if let Some(idx) = s.iter().position(|b| *b == b'\\') { s[idx] } else { 42 }
|
||||
}
|
||||
// CHECK-LABEL: @rposition_slice_to_no_bounds_check
|
||||
#[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: panic_bounds_check
|
||||
// CHECK-NOT: unreachable
|
||||
if let Some(idx) = s.iter().rposition(|b| *b == b'\\') {
|
||||
&s[..idx]
|
||||
} else {
|
||||
s
|
||||
}
|
||||
if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { &s[..idx] } else { s }
|
||||
}
|
||||
|
||||
// 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: panic_bounds_check
|
||||
// CHECK-NOT: unreachable
|
||||
if let Some(idx) = s.iter().rposition(|b| *b == b'\\') {
|
||||
&s[idx..]
|
||||
} else {
|
||||
s
|
||||
}
|
||||
if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { &s[idx..] } else { s }
|
||||
}
|
||||
|
||||
// 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: panic_bounds_check
|
||||
// CHECK-NOT: unreachable
|
||||
if let Some(idx) = s.iter().rposition(|b| *b == b'\\') {
|
||||
s[idx]
|
||||
} else {
|
||||
42
|
||||
}
|
||||
if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { s[idx] } else { 42 }
|
||||
}
|
||||
|
@ -9,7 +9,9 @@ pub fn issue_75546() {
|
||||
let mut i = 1u32;
|
||||
while i < u32::MAX {
|
||||
// CHECK-NOT: panic
|
||||
if i == 0 { panic!(); }
|
||||
if i == 0 {
|
||||
panic!();
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ pub enum Variant {
|
||||
Two,
|
||||
}
|
||||
|
||||
extern {
|
||||
extern "C" {
|
||||
fn exf1();
|
||||
fn exf2();
|
||||
}
|
||||
|
@ -17,7 +17,5 @@ pub struct M([i32; 4]);
|
||||
pub fn is_infinite(v: V) -> M {
|
||||
// CHECK: fabs
|
||||
// CHECK: cmp oeq
|
||||
unsafe {
|
||||
simd_eq(simd_fabs(v), V([f32::INFINITY; 4]))
|
||||
}
|
||||
unsafe { simd_eq(simd_fabs(v), V([f32::INFINITY; 4])) }
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
//@ compile-flags: -O
|
||||
|
||||
#![crate_type="lib"]
|
||||
#![crate_type = "lib"]
|
||||
|
||||
// CHECK-LABEL: @simple_size_of_nowrap
|
||||
#[no_mangle]
|
||||
|
@ -6,9 +6,5 @@
|
||||
pub fn test(dividend: i64, divisor: i64) -> Option<i64> {
|
||||
// CHECK-LABEL: @test(
|
||||
// CHECK-NOT: panic
|
||||
if dividend > i64::min_value() && divisor != 0 {
|
||||
Some(dividend / divisor)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
if dividend > i64::min_value() && divisor != 0 { Some(dividend / divisor) } else { None }
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
//@ only-x86_64 (vectorization varies between architectures)
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
||||
// Ensure that slice + take + sum gets vectorized.
|
||||
// Currently this relies on the slice::Iter::try_fold implementation
|
||||
// CHECK-LABEL: @slice_take_sum
|
||||
|
@ -8,27 +8,27 @@ pub fn test() {
|
||||
let a = 0u8;
|
||||
&a; // keep variable in an alloca
|
||||
|
||||
// CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, ptr %a)
|
||||
// CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, ptr %a)
|
||||
|
||||
{
|
||||
let b = &Some(a);
|
||||
&b; // keep variable in an alloca
|
||||
|
||||
// CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, {{.*}})
|
||||
// CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, {{.*}})
|
||||
|
||||
// CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, {{.*}})
|
||||
// CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, {{.*}})
|
||||
|
||||
// CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, {{.*}})
|
||||
// CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, {{.*}})
|
||||
|
||||
// CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, {{.*}})
|
||||
// CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, {{.*}})
|
||||
}
|
||||
|
||||
let c = 1u8;
|
||||
&c; // keep variable in an alloca
|
||||
|
||||
// CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, ptr %c)
|
||||
// CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, ptr %c)
|
||||
|
||||
// CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, ptr %c)
|
||||
// CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, ptr %c)
|
||||
|
||||
// CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, ptr %a)
|
||||
// CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, ptr %a)
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user