Partially revert "Do not unify dereferences in GVN."

This reverts commit 917dd82628.
This commit is contained in:
dianqk 2025-03-24 16:55:24 +08:00
parent 7e0463fe93
commit fefb0dba82
No known key found for this signature in database

View file

@ -642,9 +642,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
let proj = match proj {
ProjectionElem::Deref => {
let ty = place.ty(self.local_decls, self.tcx).ty;
// unsound: https://github.com/rust-lang/rust/issues/130853
if self.tcx.sess.opts.unstable_opts.unsound_mir_opts
&& let Some(Mutability::Not) = ty.ref_mutability()
if let Some(Mutability::Not) = ty.ref_mutability()
&& let Some(pointee_ty) = ty.builtin_deref(true)
&& pointee_ty.is_freeze(self.tcx, self.typing_env())
{