Skip to content

Commit 4d7ff4e

Browse files
committed
Update some codegen tests for opaque pointers
1 parent ebc8ab1 commit 4d7ff4e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+251
-284
lines changed

src/test/codegen/abi-main-signature-32bit-c-int.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
fn main() {
88
}
99

10-
// CHECK: define i32 @main(i32{{( %0)?}}, i8**{{( %1)?}})
10+
// CHECK: define i32 @main(i32{{( %0)?}}, {{i8\*\*|ptr}}{{( %1)?}})

src/test/codegen/adjustments.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ pub fn helper(_: usize) {
1313
pub fn no_op_slice_adjustment(x: &[u8]) -> &[u8] {
1414
// We used to generate an extra alloca and memcpy for the block's trailing expression value, so
1515
// check that we copy directly to the return value slot
16-
// CHECK: %0 = insertvalue { [0 x i8]*, [[USIZE]] } undef, [0 x i8]* %x.0, 0
17-
// CHECK: %1 = insertvalue { [0 x i8]*, [[USIZE]] } %0, [[USIZE]] %x.1, 1
18-
// CHECK: ret { [0 x i8]*, [[USIZE]] } %1
16+
// CHECK: %0 = insertvalue { {{\[0 x i8\]\*|ptr}}, [[USIZE]] } undef, {{\[0 x i8\]\*|ptr}} %x.0, 0
17+
// CHECK: %1 = insertvalue { {{\[0 x i8\]\*|ptr}}, [[USIZE]] } %0, [[USIZE]] %x.1, 1
18+
// CHECK: ret { {{\[0 x i8\]\*|ptr}}, [[USIZE]] } %1
1919
{ x }
2020
}
2121

src/test/codegen/align-enum.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub struct Nested64 {
2020
#[no_mangle]
2121
pub fn align64(a: u32) -> Align64 {
2222
// CHECK: %a64 = alloca %Align64, align 64
23-
// CHECK: call void @llvm.memcpy.{{.*}}(i8* align 64 %{{.*}}, i8* align 64 %{{.*}}, i{{[0-9]+}} 64, i1 false)
23+
// CHECK: call void @llvm.memcpy.{{.*}}({{i8\*|ptr}} align 64 %{{.*}}, {{i8\*|ptr}} align 64 %{{.*}}, i{{[0-9]+}} 64, i1 false)
2424
let a64 = Align64::A(a);
2525
a64
2626
}

src/test/codegen/align-struct.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub enum Enum64 {
3232
#[no_mangle]
3333
pub fn align64(i : i32) -> Align64 {
3434
// CHECK: %a64 = alloca %Align64, align 64
35-
// CHECK: call void @llvm.memcpy.{{.*}}(i8* align 64 %{{.*}}, i8* align 64 %{{.*}}, i{{[0-9]+}} 64, i1 false)
35+
// CHECK: call void @llvm.memcpy.{{.*}}({{i8\*|ptr}} align 64 %{{.*}}, {{i8\*|ptr}} align 64 %{{.*}}, i{{[0-9]+}} 64, i1 false)
3636
let a64 = Align64(i);
3737
a64
3838
}
@@ -42,8 +42,7 @@ pub fn align64(i : i32) -> Align64 {
4242
// CHECK-LABEL: @align64_load
4343
#[no_mangle]
4444
pub fn align64_load(a: Align64) -> i32 {
45-
// CHECK: [[FIELD:%.*]] = bitcast %Align64* %{{.*}} to i32*
46-
// CHECK: {{%.*}} = load i32, i32* [[FIELD]], align 64
45+
// CHECK: {{%.*}} = load i32, {{i32\*|ptr}} {{%.*}}, align 64
4746
a.0
4847
}
4948

src/test/codegen/array-equality.rs

+7-12
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ pub fn array_eq_value(a: [u16; 3], b: [u16; 3]) -> bool {
1616
#[no_mangle]
1717
pub fn array_eq_ref(a: &[u16; 3], b: &[u16; 3]) -> bool {
1818
// CHECK: start:
19-
// CHECK: load i48, i48* %{{.+}}, align 2
20-
// CHECK: load i48, i48* %{{.+}}, align 2
19+
// CHECK: load i48, {{i48\*|ptr}} %{{.+}}, align 2
20+
// CHECK: load i48, {{i48\*|ptr}} %{{.+}}, align 2
2121
// CHECK: icmp eq i48
2222
// CHECK-NEXT: ret
2323
a == b
@@ -27,9 +27,7 @@ pub fn array_eq_ref(a: &[u16; 3], b: &[u16; 3]) -> bool {
2727
#[no_mangle]
2828
pub fn array_eq_value_still_passed_by_pointer(a: [u16; 9], b: [u16; 9]) -> bool {
2929
// CHECK-NEXT: start:
30-
// CHECK-NEXT: bitcast
31-
// CHECK-NEXT: bitcast
32-
// CHECK-NEXT: %[[CMP:.+]] = tail call i32 @{{bcmp|memcmp}}(i8* {{.*}} dereferenceable(18) %{{.+}}, i8* {{.*}} dereferenceable(18) %{{.+}}, i64 18)
30+
// CHECK: %[[CMP:.+]] = tail call i32 @{{bcmp|memcmp}}({{i8\*|ptr}} {{.*}} dereferenceable(18) %{{.+}}, {{i8\*|ptr}} {{.*}} dereferenceable(18) %{{.+}}, i64 18)
3331
// CHECK-NEXT: %[[EQ:.+]] = icmp eq i32 %[[CMP]], 0
3432
// CHECK-NEXT: ret i1 %[[EQ]]
3533
a == b
@@ -39,9 +37,7 @@ pub fn array_eq_value_still_passed_by_pointer(a: [u16; 9], b: [u16; 9]) -> bool
3937
#[no_mangle]
4038
pub fn array_eq_long(a: &[u16; 1234], b: &[u16; 1234]) -> bool {
4139
// CHECK-NEXT: start:
42-
// CHECK-NEXT: bitcast
43-
// CHECK-NEXT: bitcast
44-
// CHECK-NEXT: %[[CMP:.+]] = tail call i32 @{{bcmp|memcmp}}(i8* {{.*}} dereferenceable(2468) %{{.+}}, i8* {{.*}} dereferenceable(2468) %{{.+}}, i64 2468)
40+
// CHECK: %[[CMP:.+]] = tail call i32 @{{bcmp|memcmp}}({{i8\*|ptr}} {{.*}} dereferenceable(2468) %{{.+}}, {{i8\*|ptr}} {{.*}} dereferenceable(2468) %{{.+}}, i64 2468)
4541
// CHECK-NEXT: %[[EQ:.+]] = icmp eq i32 %[[CMP]], 0
4642
// CHECK-NEXT: ret i1 %[[EQ]]
4743
a == b
@@ -56,18 +52,17 @@ pub fn array_eq_zero_short(x: [u16; 3]) -> bool {
5652
x == [0; 3]
5753
}
5854

59-
// CHECK-LABEL: @array_eq_zero_mid([8 x i16]*
55+
// CHECK-LABEL: @array_eq_zero_mid(
6056
#[no_mangle]
6157
pub fn array_eq_zero_mid(x: [u16; 8]) -> bool {
6258
// CHECK-NEXT: start:
63-
// CHECK-NEXT: bitcast
64-
// CHECK-NEXT: %[[LOAD:.+]] = load i128,
59+
// CHECK: %[[LOAD:.+]] = load i128,
6560
// CHECK-NEXT: %[[EQ:.+]] = icmp eq i128 %[[LOAD]], 0
6661
// CHECK-NEXT: ret i1 %[[EQ]]
6762
x == [0; 8]
6863
}
6964

70-
// CHECK-LABEL: @array_eq_zero_long([1234 x i16]*
65+
// CHECK-LABEL: @array_eq_zero_long(
7166
#[no_mangle]
7267
pub fn array_eq_zero_long(x: [u16; 1234]) -> bool {
7368
// CHECK-NEXT: start:

src/test/codegen/atomic-operations.rs

+18-18
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,25 @@ use std::sync::atomic::{AtomicI32, Ordering::*};
88
// CHECK-LABEL: @compare_exchange
99
#[no_mangle]
1010
pub fn compare_exchange(a: &AtomicI32) {
11-
// CHECK: cmpxchg i32* %{{.*}}, i32 0, i32 10 monotonic monotonic
11+
// CHECK: cmpxchg {{i32\*|ptr}} %{{.*}}, i32 0, i32 10 monotonic monotonic
1212
let _ = a.compare_exchange(0, 10, Relaxed, Relaxed);
1313

14-
// CHECK: cmpxchg i32* %{{.*}}, i32 0, i32 20 release monotonic
14+
// CHECK: cmpxchg {{i32\*|ptr}} %{{.*}}, i32 0, i32 20 release monotonic
1515
let _ = a.compare_exchange(0, 20, Release, Relaxed);
1616

17-
// CHECK: cmpxchg i32* %{{.*}}, i32 0, i32 30 acquire monotonic
18-
// CHECK: cmpxchg i32* %{{.*}}, i32 0, i32 31 acquire acquire
17+
// CHECK: cmpxchg {{i32\*|ptr}} %{{.*}}, i32 0, i32 30 acquire monotonic
18+
// CHECK: cmpxchg {{i32\*|ptr}} %{{.*}}, i32 0, i32 31 acquire acquire
1919
let _ = a.compare_exchange(0, 30, Acquire, Relaxed);
2020
let _ = a.compare_exchange(0, 31, Acquire, Acquire);
2121

22-
// CHECK: cmpxchg i32* %{{.*}}, i32 0, i32 40 acq_rel monotonic
23-
// CHECK: cmpxchg i32* %{{.*}}, i32 0, i32 41 acq_rel acquire
22+
// CHECK: cmpxchg {{i32\*|ptr}} %{{.*}}, i32 0, i32 40 acq_rel monotonic
23+
// CHECK: cmpxchg {{i32\*|ptr}} %{{.*}}, i32 0, i32 41 acq_rel acquire
2424
let _ = a.compare_exchange(0, 40, AcqRel, Relaxed);
2525
let _ = a.compare_exchange(0, 41, AcqRel, Acquire);
2626

27-
// CHECK: cmpxchg i32* %{{.*}}, i32 0, i32 50 seq_cst monotonic
28-
// CHECK: cmpxchg i32* %{{.*}}, i32 0, i32 51 seq_cst acquire
29-
// CHECK: cmpxchg i32* %{{.*}}, i32 0, i32 52 seq_cst seq_cst
27+
// CHECK: cmpxchg {{i32\*|ptr}} %{{.*}}, i32 0, i32 50 seq_cst monotonic
28+
// CHECK: cmpxchg {{i32\*|ptr}} %{{.*}}, i32 0, i32 51 seq_cst acquire
29+
// CHECK: cmpxchg {{i32\*|ptr}} %{{.*}}, i32 0, i32 52 seq_cst seq_cst
3030
let _ = a.compare_exchange(0, 50, SeqCst, Relaxed);
3131
let _ = a.compare_exchange(0, 51, SeqCst, Acquire);
3232
let _ = a.compare_exchange(0, 52, SeqCst, SeqCst);
@@ -35,25 +35,25 @@ pub fn compare_exchange(a: &AtomicI32) {
3535
// CHECK-LABEL: @compare_exchange_weak
3636
#[no_mangle]
3737
pub fn compare_exchange_weak(w: &AtomicI32) {
38-
// CHECK: cmpxchg weak i32* %{{.*}}, i32 1, i32 10 monotonic monotonic
38+
// CHECK: cmpxchg weak {{i32\*|ptr}} %{{.*}}, i32 1, i32 10 monotonic monotonic
3939
let _ = w.compare_exchange_weak(1, 10, Relaxed, Relaxed);
4040

41-
// CHECK: cmpxchg weak i32* %{{.*}}, i32 1, i32 20 release monotonic
41+
// CHECK: cmpxchg weak {{i32\*|ptr}} %{{.*}}, i32 1, i32 20 release monotonic
4242
let _ = w.compare_exchange_weak(1, 20, Release, Relaxed);
4343

44-
// CHECK: cmpxchg weak i32* %{{.*}}, i32 1, i32 30 acquire monotonic
45-
// CHECK: cmpxchg weak i32* %{{.*}}, i32 1, i32 31 acquire acquire
44+
// CHECK: cmpxchg weak {{i32\*|ptr}} %{{.*}}, i32 1, i32 30 acquire monotonic
45+
// CHECK: cmpxchg weak {{i32\*|ptr}} %{{.*}}, i32 1, i32 31 acquire acquire
4646
let _ = w.compare_exchange_weak(1, 30, Acquire, Relaxed);
4747
let _ = w.compare_exchange_weak(1, 31, Acquire, Acquire);
4848

49-
// CHECK: cmpxchg weak i32* %{{.*}}, i32 1, i32 40 acq_rel monotonic
50-
// CHECK: cmpxchg weak i32* %{{.*}}, i32 1, i32 41 acq_rel acquire
49+
// CHECK: cmpxchg weak {{i32\*|ptr}} %{{.*}}, i32 1, i32 40 acq_rel monotonic
50+
// CHECK: cmpxchg weak {{i32\*|ptr}} %{{.*}}, i32 1, i32 41 acq_rel acquire
5151
let _ = w.compare_exchange_weak(1, 40, AcqRel, Relaxed);
5252
let _ = w.compare_exchange_weak(1, 41, AcqRel, Acquire);
5353

54-
// CHECK: cmpxchg weak i32* %{{.*}}, i32 1, i32 50 seq_cst monotonic
55-
// CHECK: cmpxchg weak i32* %{{.*}}, i32 1, i32 51 seq_cst acquire
56-
// CHECK: cmpxchg weak i32* %{{.*}}, i32 1, i32 52 seq_cst seq_cst
54+
// CHECK: cmpxchg weak {{i32\*|ptr}} %{{.*}}, i32 1, i32 50 seq_cst monotonic
55+
// CHECK: cmpxchg weak {{i32\*|ptr}} %{{.*}}, i32 1, i32 51 seq_cst acquire
56+
// CHECK: cmpxchg weak {{i32\*|ptr}} %{{.*}}, i32 1, i32 52 seq_cst seq_cst
5757
let _ = w.compare_exchange_weak(1, 50, SeqCst, Relaxed);
5858
let _ = w.compare_exchange_weak(1, 51, SeqCst, Acquire);
5959
let _ = w.compare_exchange_weak(1, 52, SeqCst, SeqCst);

src/test/codegen/c-variadic.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,21 @@ pub unsafe extern "C" fn use_foreign_c_variadic_0() {
2828
// Ensure that we do not remove the `va_list` passed to the foreign function when
2929
// removing the "spoofed" `VaListImpl` that is used by Rust defined C-variadics.
3030
pub unsafe extern "C" fn use_foreign_c_variadic_1_0(ap: VaList) {
31-
// CHECK: call void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap)
31+
// CHECK: call void ({{.*}}, ...) @foreign_c_variadic_1({{.*}} %ap)
3232
foreign_c_variadic_1(ap);
3333
}
3434

3535
pub unsafe extern "C" fn use_foreign_c_variadic_1_1(ap: VaList) {
36-
// CHECK: call void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, [[PARAM]] 42)
36+
// CHECK: call void ({{.*}}, ...) @foreign_c_variadic_1({{.*}} %ap, [[PARAM]] 42)
3737
foreign_c_variadic_1(ap, 42i32);
3838
}
3939
pub unsafe extern "C" fn use_foreign_c_variadic_1_2(ap: VaList) {
40-
// CHECK: call void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, [[PARAM]] 2, [[PARAM]] 42)
40+
// CHECK: call void ({{.*}}, ...) @foreign_c_variadic_1({{.*}} %ap, [[PARAM]] 2, [[PARAM]] 42)
4141
foreign_c_variadic_1(ap, 2i32, 42i32);
4242
}
4343

4444
pub unsafe extern "C" fn use_foreign_c_variadic_1_3(ap: VaList) {
45-
// CHECK: call void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, [[PARAM]] 2, [[PARAM]] 42, [[PARAM]] 0)
45+
// CHECK: call void ({{.*}}, ...) @foreign_c_variadic_1({{.*}} %ap, [[PARAM]] 2, [[PARAM]] 42, [[PARAM]] 0)
4646
foreign_c_variadic_1(ap, 2i32, 42i32, 0i32);
4747
}
4848

src/test/codegen/consts.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ pub fn inline_enum_const() -> E<i8, i16> {
4343
#[no_mangle]
4444
pub fn low_align_const() -> E<i16, [i16; 3]> {
4545
// Check that low_align_const and high_align_const use the same constant
46-
// CHECK: memcpy.p0i8.p0i8.i{{(32|64)}}(i8* align 2 %1, i8* align 2 getelementptr inbounds (<{ [4 x i8], [4 x i8] }>, <{ [4 x i8], [4 x i8] }>* [[LOW_HIGH]], i32 0, i32 0, i32 0), i{{(32|64)}} 8, i1 false)
46+
// CHECK: memcpy.{{.+}}({{i8\*|ptr}} align 2 %{{[0-9]+}}, {{i8\*|ptr}} align 2 {{.*}}[[LOW_HIGH]]{{.*}}, i{{(32|64)}} 8, i1 false)
4747
*&E::A(0)
4848
}
4949

5050
// CHECK-LABEL: @high_align_const
5151
#[no_mangle]
5252
pub fn high_align_const() -> E<i16, i32> {
5353
// Check that low_align_const and high_align_const use the same constant
54-
// CHECK: memcpy.p0i8.p0i8.i{{(32|64)}}(i8* align 4 %1, i8* align 4 getelementptr inbounds (<{ [4 x i8], [4 x i8] }>, <{ [4 x i8], [4 x i8] }>* [[LOW_HIGH]], i32 0, i32 0, i32 0), i{{(32|64)}} 8, i1 false)
54+
// CHECK: memcpy.{{.+}}({{i8\*|ptr}} align 4 %{{[0-9]+}}, {{i8\*|ptr}} align 4 {{.*}}[[LOW_HIGH]]{{.*}}, i{{(32|64)}} 8, i1 false)
5555
*&E::A(0)
5656
}

src/test/codegen/fastcall-inreg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub mod tests {
1919
#[no_mangle]
2020
pub extern "fastcall" fn f1(_: i32, _: i32, _: i32) {}
2121

22-
// CHECK: @f2(i32* inreg %_1, i32* inreg %_2, i32* %_3)
22+
// CHECK: @f2({{i32\*|ptr}} inreg %_1, {{i32\*|ptr}} inreg %_2, {{i32\*|ptr}} %_3)
2323
#[no_mangle]
2424
pub extern "fastcall" fn f2(_: *const i32, _: *const i32, _: *const i32) {}
2525

src/test/codegen/ffi-out-of-bounds-loads.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ extern "C" {
1818
fn main() {
1919
let s = S { f1: 1, f2: 2, f3: 3 };
2020
unsafe {
21-
// CHECK: load { i64, i32 }, { i64, i32 }* {{.*}}, align 4
21+
// CHECK: load { i64, i32 }, {{.*}}, align 4
2222
// CHECK: call void @foo({ i64, i32 } {{.*}})
2323
foo(s);
2424
}

src/test/codegen/function-arguments-noopt.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn boolean_call(x: bool, f: fn(bool) -> bool) -> bool {
2323
f(x)
2424
}
2525

26-
// CHECK: align 4 i32* @borrow(i32* align 4 %x)
26+
// CHECK: align 4 {{i32\*|ptr}} @borrow({{i32\*|ptr}} align 4 %x)
2727
#[no_mangle]
2828
pub fn borrow(x: &i32) -> &i32 {
2929
x
@@ -32,11 +32,11 @@ pub fn borrow(x: &i32) -> &i32 {
3232
// CHECK-LABEL: @borrow_call
3333
#[no_mangle]
3434
pub fn borrow_call(x: &i32, f: fn(&i32) -> &i32) -> &i32 {
35-
// CHECK: call align 4 i32* %f(i32* align 4 %x)
35+
// CHECK: call align 4 {{i32\*|ptr}} %f({{i32\*|ptr}} align 4 %x)
3636
f(x)
3737
}
3838

39-
// CHECK: void @struct_(%S* sret(%S){{( %0)?}}, %S* %x)
39+
// CHECK: void @struct_({{%S\*|ptr}} sret(%S){{( %0)?}}, {{%S\*|ptr}} %x)
4040
#[no_mangle]
4141
pub fn struct_(x: S) -> S {
4242
x
@@ -45,7 +45,7 @@ pub fn struct_(x: S) -> S {
4545
// CHECK-LABEL: @struct_call
4646
#[no_mangle]
4747
pub fn struct_call(x: S, f: fn(S) -> S) -> S {
48-
// CHECK: call void %f(%S* sret(%S){{( %0)?}}, %S* %{{.+}})
48+
// CHECK: call void %f({{%S\*|ptr}} sret(%S){{( %0)?}}, {{%S\*|ptr}} %{{.+}})
4949
f(x)
5050
}
5151

0 commit comments

Comments
 (0)