Skip to content

Commit

Permalink
Adapt codegen tests for NUW inference
Browse files Browse the repository at this point in the history
  • Loading branch information
TimNN committed Dec 5, 2024
1 parent 0e98766 commit 8f0ea9a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion tests/codegen/emcripten-catch-unwind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub unsafe fn test_catch_unwind(
// CHECK: [[IS_RUST_EXN_I8:%.*]] = zext i1 [[IS_RUST_EXN]] to i8

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

// CHECK: call void %catch_fn(ptr %data, ptr nonnull [[ALLOCA]])
Expand Down
2 changes: 1 addition & 1 deletion tests/codegen/issues/issue-118306.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub fn branchy(input: u64) -> u64 {
// CHECK-LABEL: @branchy(
// CHECK-NEXT: start:
// CHECK-NEXT: [[_2:%.*]] = and i64 [[INPUT:%.*]], 3
// CHECK-NEXT: [[SWITCH_GEP:%.*]] = getelementptr inbounds [4 x i64], ptr @switch.table.branchy, i64 0, i64 [[_2]]
// CHECK-NEXT: [[SWITCH_GEP:%.*]] = getelementptr inbounds{{( nuw)?}} [4 x i64], ptr @switch.table.branchy, i64 0, i64 [[_2]]
// CHECK-NEXT: [[SWITCH_LOAD:%.*]] = load i64, ptr [[SWITCH_GEP]]
// CHECK-NEXT: ret i64 [[SWITCH_LOAD]]
match input % 4 {
Expand Down
14 changes: 7 additions & 7 deletions tests/codegen/issues/issue-122805.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@
// CHECK-LABEL: define{{.*}}void @convert(
// CHECK-NOT: shufflevector
// OPT2: store i16
// OPT2-NEXT: getelementptr inbounds i8, {{.+}} 2
// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 2
// OPT2-NEXT: store i16
// OPT2-NEXT: getelementptr inbounds i8, {{.+}} 4
// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 4
// OPT2-NEXT: store i16
// OPT2-NEXT: getelementptr inbounds i8, {{.+}} 6
// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 6
// OPT2-NEXT: store i16
// OPT2-NEXT: getelementptr inbounds i8, {{.+}} 8
// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 8
// OPT2-NEXT: store i16
// OPT2-NEXT: getelementptr inbounds i8, {{.+}} 10
// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 10
// OPT2-NEXT: store i16
// OPT2-NEXT: getelementptr inbounds i8, {{.+}} 12
// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 12
// OPT2-NEXT: store i16
// OPT2-NEXT: getelementptr inbounds i8, {{.+}} 14
// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 14
// OPT2-NEXT: store i16
// OPT3LINX64: load <8 x i16>
// OPT3LINX64-NEXT: call <8 x i16> @llvm.bswap
Expand Down
12 changes: 6 additions & 6 deletions tests/codegen/slice-iter-nonnull.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// CHECK-LABEL: @slice_iter_next(
#[no_mangle]
pub fn slice_iter_next<'a>(it: &mut std::slice::Iter<'a, u32>) -> Option<&'a u32> {
// CHECK: %[[ENDP:.+]] = getelementptr inbounds i8, ptr %it, {{i32 4|i64 8}}
// CHECK: %[[ENDP:.+]] = getelementptr inbounds{{( nuw)?}} i8, ptr %it, {{i32 4|i64 8}}
// CHECK: %[[END:.+]] = load ptr, ptr %[[ENDP]]
// CHECK-SAME: !nonnull
// CHECK-SAME: !noundef
Expand All @@ -31,7 +31,7 @@ pub fn slice_iter_next<'a>(it: &mut std::slice::Iter<'a, u32>) -> Option<&'a u32
// CHECK-LABEL: @slice_iter_next_back(
#[no_mangle]
pub fn slice_iter_next_back<'a>(it: &mut std::slice::Iter<'a, u32>) -> Option<&'a u32> {
// CHECK: %[[ENDP:.+]] = getelementptr inbounds i8, ptr %it, {{i32 4|i64 8}}
// CHECK: %[[ENDP:.+]] = getelementptr inbounds{{( nuw)?}} i8, ptr %it, {{i32 4|i64 8}}
// CHECK: %[[END:.+]] = load ptr, ptr %[[ENDP]]
// CHECK-SAME: !nonnull
// CHECK-SAME: !noundef
Expand All @@ -55,7 +55,7 @@ pub fn slice_iter_next_back<'a>(it: &mut std::slice::Iter<'a, u32>) -> Option<&'
#[no_mangle]
pub fn slice_iter_new(slice: &[u32]) -> std::slice::Iter<'_, u32> {
// CHECK-NOT: slice
// CHECK: %[[END:.+]] = getelementptr inbounds i32{{.+}} %slice.0{{.+}} %slice.1
// CHECK: %[[END:.+]] = getelementptr inbounds{{( nuw)?}} i32{{.+}} %slice.0{{.+}} %slice.1
// CHECK-NOT: slice
// CHECK: insertvalue {{.+}} ptr %slice.0, 0
// CHECK-NOT: slice
Expand All @@ -70,7 +70,7 @@ pub fn slice_iter_new(slice: &[u32]) -> std::slice::Iter<'_, u32> {
#[no_mangle]
pub fn slice_iter_mut_new(slice: &mut [u32]) -> std::slice::IterMut<'_, u32> {
// CHECK-NOT: slice
// CHECK: %[[END:.+]] = getelementptr inbounds i32{{.+}} %slice.0{{.+}} %slice.1
// CHECK: %[[END:.+]] = getelementptr inbounds{{( nuw)?}} i32{{.+}} %slice.0{{.+}} %slice.1
// CHECK-NOT: slice
// CHECK: insertvalue {{.+}} ptr %slice.0, 0
// CHECK-NOT: slice
Expand All @@ -83,7 +83,7 @@ pub fn slice_iter_mut_new(slice: &mut [u32]) -> std::slice::IterMut<'_, u32> {
// CHECK-LABEL: @slice_iter_is_empty
#[no_mangle]
pub fn slice_iter_is_empty(it: &std::slice::Iter<'_, u32>) -> bool {
// CHECK: %[[ENDP:.+]] = getelementptr inbounds i8, ptr %it, {{i32 4|i64 8}}
// CHECK: %[[ENDP:.+]] = getelementptr inbounds{{( nuw)?}} i8, ptr %it, {{i32 4|i64 8}}
// CHECK: %[[END:.+]] = load ptr, ptr %[[ENDP]]
// CHECK-SAME: !nonnull
// CHECK-SAME: !noundef
Expand All @@ -99,7 +99,7 @@ pub fn slice_iter_is_empty(it: &std::slice::Iter<'_, u32>) -> bool {
// CHECK-LABEL: @slice_iter_len
#[no_mangle]
pub fn slice_iter_len(it: &std::slice::Iter<'_, u32>) -> usize {
// CHECK: %[[ENDP:.+]] = getelementptr inbounds i8, ptr %it, {{i32 4|i64 8}}
// CHECK: %[[ENDP:.+]] = getelementptr inbounds{{( nuw)?}} i8, ptr %it, {{i32 4|i64 8}}
// CHECK: %[[END:.+]] = load ptr, ptr %[[ENDP]]
// CHECK-SAME: !nonnull
// CHECK-SAME: !noundef
Expand Down

0 comments on commit 8f0ea9a

Please sign in to comment.