Skip to content

Commit 8f0ea9a

Browse files
committed
Adapt codegen tests for NUW inference
1 parent 0e98766 commit 8f0ea9a

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

tests/codegen/emcripten-catch-unwind.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub unsafe fn test_catch_unwind(
5757
// CHECK: [[IS_RUST_EXN_I8:%.*]] = zext i1 [[IS_RUST_EXN]] to i8
5858

5959
// CHECK: store ptr [[EXCEPTION]], ptr [[ALLOCA]]
60-
// CHECK: [[IS_RUST_SLOT:%.*]] = getelementptr inbounds i8, ptr [[ALLOCA]], [[PTR_SIZE]]
60+
// CHECK: [[IS_RUST_SLOT:%.*]] = getelementptr inbounds{{( nuw)?}} i8, ptr [[ALLOCA]], [[PTR_SIZE]]
6161
// CHECK: store i8 [[IS_RUST_EXN_I8]], ptr [[IS_RUST_SLOT]]
6262

6363
// CHECK: call void %catch_fn(ptr %data, ptr nonnull [[ALLOCA]])

tests/codegen/issues/issue-118306.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub fn branchy(input: u64) -> u64 {
1212
// CHECK-LABEL: @branchy(
1313
// CHECK-NEXT: start:
1414
// CHECK-NEXT: [[_2:%.*]] = and i64 [[INPUT:%.*]], 3
15-
// CHECK-NEXT: [[SWITCH_GEP:%.*]] = getelementptr inbounds [4 x i64], ptr @switch.table.branchy, i64 0, i64 [[_2]]
15+
// CHECK-NEXT: [[SWITCH_GEP:%.*]] = getelementptr inbounds{{( nuw)?}} [4 x i64], ptr @switch.table.branchy, i64 0, i64 [[_2]]
1616
// CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i64, ptr [[SWITCH_GEP]]
1717
// CHECK-NEXT: ret i64 [[SWITCH_LOAD]]
1818
match input % 4 {

tests/codegen/issues/issue-122805.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@
1717
// CHECK-LABEL: define{{.*}}void @convert(
1818
// CHECK-NOT: shufflevector
1919
// OPT2: store i16
20-
// OPT2-NEXT: getelementptr inbounds i8, {{.+}} 2
20+
// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 2
2121
// OPT2-NEXT: store i16
22-
// OPT2-NEXT: getelementptr inbounds i8, {{.+}} 4
22+
// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 4
2323
// OPT2-NEXT: store i16
24-
// OPT2-NEXT: getelementptr inbounds i8, {{.+}} 6
24+
// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 6
2525
// OPT2-NEXT: store i16
26-
// OPT2-NEXT: getelementptr inbounds i8, {{.+}} 8
26+
// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 8
2727
// OPT2-NEXT: store i16
28-
// OPT2-NEXT: getelementptr inbounds i8, {{.+}} 10
28+
// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 10
2929
// OPT2-NEXT: store i16
30-
// OPT2-NEXT: getelementptr inbounds i8, {{.+}} 12
30+
// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 12
3131
// OPT2-NEXT: store i16
32-
// OPT2-NEXT: getelementptr inbounds i8, {{.+}} 14
32+
// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 14
3333
// OPT2-NEXT: store i16
3434
// OPT3LINX64: load <8 x i16>
3535
// OPT3LINX64-NEXT: call <8 x i16> @llvm.bswap

tests/codegen/slice-iter-nonnull.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// CHECK-LABEL: @slice_iter_next(
1515
#[no_mangle]
1616
pub fn slice_iter_next<'a>(it: &mut std::slice::Iter<'a, u32>) -> Option<&'a u32> {
17-
// CHECK: %[[ENDP:.+]] = getelementptr inbounds i8, ptr %it, {{i32 4|i64 8}}
17+
// CHECK: %[[ENDP:.+]] = getelementptr inbounds{{( nuw)?}} i8, ptr %it, {{i32 4|i64 8}}
1818
// CHECK: %[[END:.+]] = load ptr, ptr %[[ENDP]]
1919
// CHECK-SAME: !nonnull
2020
// CHECK-SAME: !noundef
@@ -31,7 +31,7 @@ pub fn slice_iter_next<'a>(it: &mut std::slice::Iter<'a, u32>) -> Option<&'a u32
3131
// CHECK-LABEL: @slice_iter_next_back(
3232
#[no_mangle]
3333
pub fn slice_iter_next_back<'a>(it: &mut std::slice::Iter<'a, u32>) -> Option<&'a u32> {
34-
// CHECK: %[[ENDP:.+]] = getelementptr inbounds i8, ptr %it, {{i32 4|i64 8}}
34+
// CHECK: %[[ENDP:.+]] = getelementptr inbounds{{( nuw)?}} i8, ptr %it, {{i32 4|i64 8}}
3535
// CHECK: %[[END:.+]] = load ptr, ptr %[[ENDP]]
3636
// CHECK-SAME: !nonnull
3737
// CHECK-SAME: !noundef
@@ -55,7 +55,7 @@ pub fn slice_iter_next_back<'a>(it: &mut std::slice::Iter<'a, u32>) -> Option<&'
5555
#[no_mangle]
5656
pub fn slice_iter_new(slice: &[u32]) -> std::slice::Iter<'_, u32> {
5757
// CHECK-NOT: slice
58-
// CHECK: %[[END:.+]] = getelementptr inbounds i32{{.+}} %slice.0{{.+}} %slice.1
58+
// CHECK: %[[END:.+]] = getelementptr inbounds{{( nuw)?}} i32{{.+}} %slice.0{{.+}} %slice.1
5959
// CHECK-NOT: slice
6060
// CHECK: insertvalue {{.+}} ptr %slice.0, 0
6161
// CHECK-NOT: slice
@@ -70,7 +70,7 @@ pub fn slice_iter_new(slice: &[u32]) -> std::slice::Iter<'_, u32> {
7070
#[no_mangle]
7171
pub fn slice_iter_mut_new(slice: &mut [u32]) -> std::slice::IterMut<'_, u32> {
7272
// CHECK-NOT: slice
73-
// CHECK: %[[END:.+]] = getelementptr inbounds i32{{.+}} %slice.0{{.+}} %slice.1
73+
// CHECK: %[[END:.+]] = getelementptr inbounds{{( nuw)?}} i32{{.+}} %slice.0{{.+}} %slice.1
7474
// CHECK-NOT: slice
7575
// CHECK: insertvalue {{.+}} ptr %slice.0, 0
7676
// CHECK-NOT: slice
@@ -83,7 +83,7 @@ pub fn slice_iter_mut_new(slice: &mut [u32]) -> std::slice::IterMut<'_, u32> {
8383
// CHECK-LABEL: @slice_iter_is_empty
8484
#[no_mangle]
8585
pub fn slice_iter_is_empty(it: &std::slice::Iter<'_, u32>) -> bool {
86-
// CHECK: %[[ENDP:.+]] = getelementptr inbounds i8, ptr %it, {{i32 4|i64 8}}
86+
// CHECK: %[[ENDP:.+]] = getelementptr inbounds{{( nuw)?}} i8, ptr %it, {{i32 4|i64 8}}
8787
// CHECK: %[[END:.+]] = load ptr, ptr %[[ENDP]]
8888
// CHECK-SAME: !nonnull
8989
// CHECK-SAME: !noundef
@@ -99,7 +99,7 @@ pub fn slice_iter_is_empty(it: &std::slice::Iter<'_, u32>) -> bool {
9999
// CHECK-LABEL: @slice_iter_len
100100
#[no_mangle]
101101
pub fn slice_iter_len(it: &std::slice::Iter<'_, u32>) -> usize {
102-
// CHECK: %[[ENDP:.+]] = getelementptr inbounds i8, ptr %it, {{i32 4|i64 8}}
102+
// CHECK: %[[ENDP:.+]] = getelementptr inbounds{{( nuw)?}} i8, ptr %it, {{i32 4|i64 8}}
103103
// CHECK: %[[END:.+]] = load ptr, ptr %[[ENDP]]
104104
// CHECK-SAME: !nonnull
105105
// CHECK-SAME: !noundef

0 commit comments

Comments
 (0)