Skip to content

Commit

Permalink
make check lines for int/ptr common prim test more permissive
Browse files Browse the repository at this point in the history
It seems that LLVM 17 doesn't fully optimize out unwrap_unchecked.

We can just loosen the check lines to account for this, since we don't
really care about the exact instructions, we just want to make sure that
inttoptr/ptrtoint aren't used for Box.
  • Loading branch information
erikdesjardins committed Mar 7, 2024
1 parent 8e40b17 commit 5ccada6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/codegen/common_prim_int_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ pub fn insert_box(x: Box<()>) -> Result<usize, Box<()>> {
// CHECK-LABEL: @extract_int
#[no_mangle]
pub unsafe fn extract_int(x: Result<usize, Box<()>>) -> usize {
// CHECK: start:
// CHECK-NEXT: ptrtoint
// CHECK-NEXT: ret
// CHECK: ptrtoint
x.unwrap_unchecked()
}

// CHECK-LABEL: @extract_box
#[no_mangle]
pub unsafe fn extract_box(x: Result<usize, Box<()>>) -> Box<()> {
// CHECK: start:
// CHECK-NEXT: ret ptr
// CHECK-NOT: ptrtoint
// CHECK-NOT: inttoptr
// CHECK-NOT: load
// CHECK-NOT: store
x.unwrap_err_unchecked()
}

0 comments on commit 5ccada6

Please sign in to comment.