Skip to content

Commit

Permalink
Auto merge of #126844 - scottmcm:more-ptr-cast-gvn, r=saethlin
Browse files Browse the repository at this point in the history
Remove more `PtrToPtr` casts in GVN

This addresses two things I noticed in MIR:

1. `NonNull::<T>::eq` does `(a as *mut T) == (b as *mut T)`, but it could just compare the `*const T`s, so this removes `PtrToPtr` casts that are on both sides of a pointer comparison, so long as they're not fat-to-thin casts.

2. `NonNull::<T>::addr` does `transmute::<_, usize>(p as *const ())`, but so long as `T: Thin` that cast doesn't do anything, and thus we can directly transmute the `*const T` instead.

r? mir-opt
  • Loading branch information
bors committed Jun 26, 2024
2 parents 7bbbbb3 + 96f9d9f commit 7534703
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit 7534703

Please sign in to comment.