Skip to content

Commit da47736

Browse files
committed
CHECK only for opaque ptr
1 parent 190ded8 commit da47736

Some content is hidden

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

52 files changed

+251
-251
lines changed

tests/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{{( hidden)?}} i32 @main(i32{{( %0)?}}, {{i8\*\*|ptr}}{{( %1)?}})
10+
// CHECK: define{{( hidden)?}} i32 @main(i32{{( %0)?}}, ptr{{( %1)?}})

tests/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\]\*|ptr}}, [[USIZE]] } poison, {{\[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
16+
// CHECK: %0 = insertvalue { ptr, [[USIZE]] } poison, ptr %x.0, 0
17+
// CHECK: %1 = insertvalue { ptr, [[USIZE]] } %0, [[USIZE]] %x.1, 1
18+
// CHECK: ret { ptr, [[USIZE]] } %1
1919
{ x }
2020
}
2121

tests/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\*|ptr}} align 64 %{{.*}}, {{i8\*|ptr}} align 64 %{{.*}}, i{{[0-9]+}} 64, i1 false)
23+
// CHECK: call void @llvm.memcpy.{{.*}}(ptr align 64 %{{.*}}, ptr align 64 %{{.*}}, i{{[0-9]+}} 64, i1 false)
2424
let a64 = Align64::A(a);
2525
a64
2626
}

tests/codegen/align-struct.rs

+2-2
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\*|ptr}} align 64 %{{.*}}, {{i8\*|ptr}} align 64 %{{.*}}, i{{[0-9]+}} 64, i1 false)
35+
// CHECK: call void @llvm.memcpy.{{.*}}(ptr align 64 %{{.*}}, ptr align 64 %{{.*}}, i{{[0-9]+}} 64, i1 false)
3636
let a64 = Align64(i);
3737
a64
3838
}
@@ -42,7 +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: {{%.*}} = load i32, {{i32\*|ptr}} {{%.*}}, align 64
45+
// CHECK: {{%.*}} = load i32, ptr {{%.*}}, align 64
4646
a.0
4747
}
4848

tests/codegen/array-equality.rs

+4-4
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\*|ptr}} %{{.+}}, align 2
20-
// CHECK: load i48, {{i48\*|ptr}} %{{.+}}, align 2
19+
// CHECK: load i48, ptr %{{.+}}, align 2
20+
// CHECK: load i48, ptr %{{.+}}, align 2
2121
// CHECK: icmp eq i48
2222
// CHECK-NEXT: ret
2323
a == b
@@ -27,7 +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: %[[CMP:.+]] = tail call i32 @{{bcmp|memcmp}}({{i8\*|ptr}} {{.*}} dereferenceable(18) %{{.+}}, {{i8\*|ptr}} {{.*}} dereferenceable(18) %{{.+}}, i64 18)
30+
// CHECK: %[[CMP:.+]] = tail call i32 @{{bcmp|memcmp}}(ptr {{.*}} dereferenceable(18) %{{.+}}, ptr {{.*}} dereferenceable(18) %{{.+}}, i64 18)
3131
// CHECK-NEXT: %[[EQ:.+]] = icmp eq i32 %[[CMP]], 0
3232
// CHECK-NEXT: ret i1 %[[EQ]]
3333
a == b
@@ -37,7 +37,7 @@ pub fn array_eq_value_still_passed_by_pointer(a: [u16; 9], b: [u16; 9]) -> bool
3737
#[no_mangle]
3838
pub fn array_eq_long(a: &[u16; 1234], b: &[u16; 1234]) -> bool {
3939
// CHECK-NEXT: start:
40-
// CHECK: %[[CMP:.+]] = tail call i32 @{{bcmp|memcmp}}({{i8\*|ptr}} {{.*}} dereferenceable(2468) %{{.+}}, {{i8\*|ptr}} {{.*}} dereferenceable(2468) %{{.+}}, i64 2468)
40+
// CHECK: %[[CMP:.+]] = tail call i32 @{{bcmp|memcmp}}(ptr {{.*}} dereferenceable(2468) %{{.+}}, ptr {{.*}} dereferenceable(2468) %{{.+}}, i64 2468)
4141
// CHECK-NEXT: %[[EQ:.+]] = icmp eq i32 %[[CMP]], 0
4242
// CHECK-NEXT: ret i1 %[[EQ]]
4343
a == b

tests/codegen/atomic-operations.rs

+30-30
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,37 @@ use std::sync::atomic::{AtomicI32, Ordering::*};
77
// CHECK-LABEL: @compare_exchange
88
#[no_mangle]
99
pub fn compare_exchange(a: &AtomicI32) {
10-
// CHECK: cmpxchg {{i32\*|ptr}} %{{.*}}, i32 0, i32 10 monotonic monotonic
11-
// CHECK: cmpxchg {{i32\*|ptr}} %{{.*}}, i32 0, i32 11 monotonic acquire
12-
// CHECK: cmpxchg {{i32\*|ptr}} %{{.*}}, i32 0, i32 12 monotonic seq_cst
10+
// CHECK: cmpxchg ptr %{{.*}}, i32 0, i32 10 monotonic monotonic
11+
// CHECK: cmpxchg ptr %{{.*}}, i32 0, i32 11 monotonic acquire
12+
// CHECK: cmpxchg ptr %{{.*}}, i32 0, i32 12 monotonic seq_cst
1313
let _ = a.compare_exchange(0, 10, Relaxed, Relaxed);
1414
let _ = a.compare_exchange(0, 11, Relaxed, Acquire);
1515
let _ = a.compare_exchange(0, 12, Relaxed, SeqCst);
1616

17-
// CHECK: cmpxchg {{i32\*|ptr}} %{{.*}}, i32 0, i32 20 release monotonic
18-
// CHECK: cmpxchg {{i32\*|ptr}} %{{.*}}, i32 0, i32 21 release acquire
19-
// CHECK: cmpxchg {{i32\*|ptr}} %{{.*}}, i32 0, i32 22 release seq_cst
17+
// CHECK: cmpxchg ptr %{{.*}}, i32 0, i32 20 release monotonic
18+
// CHECK: cmpxchg ptr %{{.*}}, i32 0, i32 21 release acquire
19+
// CHECK: cmpxchg ptr %{{.*}}, i32 0, i32 22 release seq_cst
2020
let _ = a.compare_exchange(0, 20, Release, Relaxed);
2121
let _ = a.compare_exchange(0, 21, Release, Acquire);
2222
let _ = a.compare_exchange(0, 22, Release, SeqCst);
2323

24-
// CHECK: cmpxchg {{i32\*|ptr}} %{{.*}}, i32 0, i32 30 acquire monotonic
25-
// CHECK: cmpxchg {{i32\*|ptr}} %{{.*}}, i32 0, i32 31 acquire acquire
26-
// CHECK: cmpxchg {{i32\*|ptr}} %{{.*}}, i32 0, i32 32 acquire seq_cst
24+
// CHECK: cmpxchg ptr %{{.*}}, i32 0, i32 30 acquire monotonic
25+
// CHECK: cmpxchg ptr %{{.*}}, i32 0, i32 31 acquire acquire
26+
// CHECK: cmpxchg ptr %{{.*}}, i32 0, i32 32 acquire seq_cst
2727
let _ = a.compare_exchange(0, 30, Acquire, Relaxed);
2828
let _ = a.compare_exchange(0, 31, Acquire, Acquire);
2929
let _ = a.compare_exchange(0, 32, Acquire, SeqCst);
3030

31-
// CHECK: cmpxchg {{i32\*|ptr}} %{{.*}}, i32 0, i32 40 acq_rel monotonic
32-
// CHECK: cmpxchg {{i32\*|ptr}} %{{.*}}, i32 0, i32 41 acq_rel acquire
33-
// CHECK: cmpxchg {{i32\*|ptr}} %{{.*}}, i32 0, i32 42 acq_rel seq_cst
31+
// CHECK: cmpxchg ptr %{{.*}}, i32 0, i32 40 acq_rel monotonic
32+
// CHECK: cmpxchg ptr %{{.*}}, i32 0, i32 41 acq_rel acquire
33+
// CHECK: cmpxchg ptr %{{.*}}, i32 0, i32 42 acq_rel seq_cst
3434
let _ = a.compare_exchange(0, 40, AcqRel, Relaxed);
3535
let _ = a.compare_exchange(0, 41, AcqRel, Acquire);
3636
let _ = a.compare_exchange(0, 42, AcqRel, SeqCst);
3737

38-
// CHECK: cmpxchg {{i32\*|ptr}} %{{.*}}, i32 0, i32 50 seq_cst monotonic
39-
// CHECK: cmpxchg {{i32\*|ptr}} %{{.*}}, i32 0, i32 51 seq_cst acquire
40-
// CHECK: cmpxchg {{i32\*|ptr}} %{{.*}}, i32 0, i32 52 seq_cst seq_cst
38+
// CHECK: cmpxchg ptr %{{.*}}, i32 0, i32 50 seq_cst monotonic
39+
// CHECK: cmpxchg ptr %{{.*}}, i32 0, i32 51 seq_cst acquire
40+
// CHECK: cmpxchg ptr %{{.*}}, i32 0, i32 52 seq_cst seq_cst
4141
let _ = a.compare_exchange(0, 50, SeqCst, Relaxed);
4242
let _ = a.compare_exchange(0, 51, SeqCst, Acquire);
4343
let _ = a.compare_exchange(0, 52, SeqCst, SeqCst);
@@ -46,37 +46,37 @@ pub fn compare_exchange(a: &AtomicI32) {
4646
// CHECK-LABEL: @compare_exchange_weak
4747
#[no_mangle]
4848
pub fn compare_exchange_weak(w: &AtomicI32) {
49-
// CHECK: cmpxchg weak {{i32\*|ptr}} %{{.*}}, i32 1, i32 10 monotonic monotonic
50-
// CHECK: cmpxchg weak {{i32\*|ptr}} %{{.*}}, i32 1, i32 11 monotonic acquire
51-
// CHECK: cmpxchg weak {{i32\*|ptr}} %{{.*}}, i32 1, i32 12 monotonic seq_cst
49+
// CHECK: cmpxchg weak ptr %{{.*}}, i32 1, i32 10 monotonic monotonic
50+
// CHECK: cmpxchg weak ptr %{{.*}}, i32 1, i32 11 monotonic acquire
51+
// CHECK: cmpxchg weak ptr %{{.*}}, i32 1, i32 12 monotonic seq_cst
5252
let _ = w.compare_exchange_weak(1, 10, Relaxed, Relaxed);
5353
let _ = w.compare_exchange_weak(1, 11, Relaxed, Acquire);
5454
let _ = w.compare_exchange_weak(1, 12, Relaxed, SeqCst);
5555

56-
// CHECK: cmpxchg weak {{i32\*|ptr}} %{{.*}}, i32 1, i32 20 release monotonic
57-
// CHECK: cmpxchg weak {{i32\*|ptr}} %{{.*}}, i32 1, i32 21 release acquire
58-
// CHECK: cmpxchg weak {{i32\*|ptr}} %{{.*}}, i32 1, i32 22 release seq_cst
56+
// CHECK: cmpxchg weak ptr %{{.*}}, i32 1, i32 20 release monotonic
57+
// CHECK: cmpxchg weak ptr %{{.*}}, i32 1, i32 21 release acquire
58+
// CHECK: cmpxchg weak ptr %{{.*}}, i32 1, i32 22 release seq_cst
5959
let _ = w.compare_exchange_weak(1, 20, Release, Relaxed);
6060
let _ = w.compare_exchange_weak(1, 21, Release, Acquire);
6161
let _ = w.compare_exchange_weak(1, 22, Release, SeqCst);
6262

63-
// CHECK: cmpxchg weak {{i32\*|ptr}} %{{.*}}, i32 1, i32 30 acquire monotonic
64-
// CHECK: cmpxchg weak {{i32\*|ptr}} %{{.*}}, i32 1, i32 31 acquire acquire
65-
// CHECK: cmpxchg weak {{i32\*|ptr}} %{{.*}}, i32 1, i32 32 acquire seq_cst
63+
// CHECK: cmpxchg weak ptr %{{.*}}, i32 1, i32 30 acquire monotonic
64+
// CHECK: cmpxchg weak ptr %{{.*}}, i32 1, i32 31 acquire acquire
65+
// CHECK: cmpxchg weak ptr %{{.*}}, i32 1, i32 32 acquire seq_cst
6666
let _ = w.compare_exchange_weak(1, 30, Acquire, Relaxed);
6767
let _ = w.compare_exchange_weak(1, 31, Acquire, Acquire);
6868
let _ = w.compare_exchange_weak(1, 32, Acquire, SeqCst);
6969

70-
// CHECK: cmpxchg weak {{i32\*|ptr}} %{{.*}}, i32 1, i32 40 acq_rel monotonic
71-
// CHECK: cmpxchg weak {{i32\*|ptr}} %{{.*}}, i32 1, i32 41 acq_rel acquire
72-
// CHECK: cmpxchg weak {{i32\*|ptr}} %{{.*}}, i32 1, i32 42 acq_rel seq_cst
70+
// CHECK: cmpxchg weak ptr %{{.*}}, i32 1, i32 40 acq_rel monotonic
71+
// CHECK: cmpxchg weak ptr %{{.*}}, i32 1, i32 41 acq_rel acquire
72+
// CHECK: cmpxchg weak ptr %{{.*}}, i32 1, i32 42 acq_rel seq_cst
7373
let _ = w.compare_exchange_weak(1, 40, AcqRel, Relaxed);
7474
let _ = w.compare_exchange_weak(1, 41, AcqRel, Acquire);
7575
let _ = w.compare_exchange_weak(1, 42, AcqRel, SeqCst);
7676

77-
// CHECK: cmpxchg weak {{i32\*|ptr}} %{{.*}}, i32 1, i32 50 seq_cst monotonic
78-
// CHECK: cmpxchg weak {{i32\*|ptr}} %{{.*}}, i32 1, i32 51 seq_cst acquire
79-
// CHECK: cmpxchg weak {{i32\*|ptr}} %{{.*}}, i32 1, i32 52 seq_cst seq_cst
77+
// CHECK: cmpxchg weak ptr %{{.*}}, i32 1, i32 50 seq_cst monotonic
78+
// CHECK: cmpxchg weak ptr %{{.*}}, i32 1, i32 51 seq_cst acquire
79+
// CHECK: cmpxchg weak ptr %{{.*}}, i32 1, i32 52 seq_cst seq_cst
8080
let _ = w.compare_exchange_weak(1, 50, SeqCst, Relaxed);
8181
let _ = w.compare_exchange_weak(1, 51, SeqCst, Acquire);
8282
let _ = w.compare_exchange_weak(1, 52, SeqCst, SeqCst);

tests/codegen/avr/avr-func-addrspace.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ pub extern "C" fn test() {
9494

9595
// Validate that we can codegen transmutes between data ptrs and fn ptrs.
9696

97-
// CHECK: define{{.+}}{{void \(\) addrspace\(1\)\*|ptr addrspace\(1\)}} @transmute_data_ptr_to_fn({{\{\}\*|ptr}}{{.*}} %x)
97+
// CHECK: define{{.+}}ptr addrspace(1) @transmute_data_ptr_to_fn(ptr{{.*}} %x)
9898
#[no_mangle]
9999
pub unsafe fn transmute_data_ptr_to_fn(x: *const ()) -> fn() {
100100
// It doesn't matter precisely how this is codegenned (through memory or an addrspacecast),
101101
// as long as it doesn't cause a verifier error by using `bitcast`.
102102
transmute(x)
103103
}
104104

105-
// CHECK: define{{.+}}{{\{\}\*|ptr}} @transmute_fn_ptr_to_data({{void \(\) addrspace\(1\)\*|ptr addrspace\(1\)}}{{.*}} %x)
105+
// CHECK: define{{.+}}ptr @transmute_fn_ptr_to_data(ptr addrspace(1){{.*}} %x)
106106
#[no_mangle]
107107
pub unsafe fn transmute_fn_ptr_to_data(x: fn()) -> *const () {
108108
// It doesn't matter precisely how this is codegenned (through memory or an addrspacecast),
@@ -116,7 +116,7 @@ pub enum Either<T, U> { A(T), B(U) }
116116
// with the `ptr` field representing both `&i32` and `fn()` depending on the variant.
117117
// This is incorrect, because `fn()` should be `ptr addrspace(1)`, not `ptr`.
118118

119-
// CHECK: define{{.+}}void @should_not_combine_addrspace({{.+\*|ptr}}{{.+}}sret{{.+}}%_0, {{.+\*|ptr}}{{.+}}%x)
119+
// CHECK: define{{.+}}void @should_not_combine_addrspace(ptr{{.+}}sret{{.+}}%_0, ptr{{.+}}%x)
120120
#[no_mangle]
121121
#[inline(never)]
122122
pub fn should_not_combine_addrspace(x: Either<&i32, fn()>) -> Either<&i32, fn()> {

tests/codegen/drop-in-place-noalias.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
use std::marker::PhantomPinned;
99

10-
// CHECK: define internal void @{{.*}}core{{.*}}ptr{{.*}}drop_in_place{{.*}}StructUnpin{{.*}}({{.*\*|ptr}} noalias noundef align 4 dereferenceable(12) %{{.+}})
10+
// CHECK: define internal void @{{.*}}core{{.*}}ptr{{.*}}drop_in_place{{.*}}StructUnpin{{.*}}(ptr noalias noundef align 4 dereferenceable(12) %{{.+}})
1111

12-
// CHECK: define internal void @{{.*}}core{{.*}}ptr{{.*}}drop_in_place{{.*}}StructNotUnpin{{.*}}({{.*\*|ptr}} noundef nonnull align 4 %{{.+}})
12+
// CHECK: define internal void @{{.*}}core{{.*}}ptr{{.*}}drop_in_place{{.*}}StructNotUnpin{{.*}}(ptr noundef nonnull align 4 %{{.+}})
1313

1414
pub struct StructUnpin {
1515
a: i32,

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

tests/codegen/function-arguments-noopt.rs

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

26-
// CHECK: align 4 {{i32\*|ptr}} @borrow({{i32\*|ptr}} align 4 %x)
26+
// CHECK: align 4 ptr @borrow(ptr align 4 %x)
2727
#[no_mangle]
2828
pub fn borrow(x: &i32) -> &i32 {
2929
x
3030
}
3131

32-
// CHECK: align 4 {{i32\*|ptr}} @borrow_mut({{i32\*|ptr}} align 4 %x)
32+
// CHECK: align 4 ptr @borrow_mut(ptr align 4 %x)
3333
#[no_mangle]
3434
pub fn borrow_mut(x: &mut i32) -> &mut i32 {
3535
x
@@ -38,11 +38,11 @@ pub fn borrow_mut(x: &mut i32) -> &mut i32 {
3838
// CHECK-LABEL: @borrow_call
3939
#[no_mangle]
4040
pub fn borrow_call(x: &i32, f: fn(&i32) -> &i32) -> &i32 {
41-
// CHECK: call align 4 {{i32\*|ptr}} %f({{i32\*|ptr}} align 4 %x)
41+
// CHECK: call align 4 ptr %f(ptr align 4 %x)
4242
f(x)
4343
}
4444

45-
// CHECK: void @struct_({{%S\*|ptr}} sret(%S) align 4{{( %_0)?}}, {{%S\*|ptr}} align 4 %x)
45+
// CHECK: void @struct_(ptr sret(%S) align 4{{( %_0)?}}, ptr align 4 %x)
4646
#[no_mangle]
4747
pub fn struct_(x: S) -> S {
4848
x
@@ -51,7 +51,7 @@ pub fn struct_(x: S) -> S {
5151
// CHECK-LABEL: @struct_call
5252
#[no_mangle]
5353
pub fn struct_call(x: S, f: fn(S) -> S) -> S {
54-
// CHECK: call void %f({{%S\*|ptr}} sret(%S) align 4{{( %_0)?}}, {{%S\*|ptr}} align 4 %{{.+}})
54+
// CHECK: call void %f(ptr sret(%S) align 4{{( %_0)?}}, ptr align 4 %{{.+}})
5555
f(x)
5656
}
5757

0 commit comments

Comments
 (0)